Project Journal for Hunter Field



=============== Week 15: =================


Entry 6: -----------------------------------------------------------------

Date: April 25th
Start Time: 2:15pm
Duration: 4.25 hours

Ran back to lab after a quick lunch and find that Cullen and Visuwanaath haven’t made a ton of progress but nothings broken. They said they thought they fried the LoRa breakout board. That would be heartbreaking today. Also, this is probably my favorite pic from this entire project.

example1
frankenstein beacon with its guts everywhere

We crammed everything into the case. There isn’t space for the LoRa breakout board inside so we wrapped the wires around the back and taped them. Kinda jank but it gets them out of the way. Here is the final device:

example1
selfie before we demo

Presentation is in a few minutes and we are running tests like crazy jsut to verify everything still works. Visuwanaath also wired up the vibration motor to his PCB so we might give us the stretch PSDR if we’re lucky. Ok they're walking over to us AHHHHHHHHH.

We just did our demo and the LoRa didn’t feel like working so they gave us the OLED and Buck converter checkoffs but will swing back once we get LoRa working. We’re just sitting here after getting it working by yanking the wires or something. Idk it just started working again the second they left. Just our luck. I am telling Cullen not to touch anything because he can’t get his grimy hands off of the surprisingly functional LoRa wires.

Just redid the demo after a two hour wait and LoRa worked just as planned. 4/5 PSDRs and possibly the stretch ain’t nothing for this team to be ashamed of after all the shit we dealt with the past two weeks. Here is the final product.

example1
the finished Buddy Beacon


Entry 5: -----------------------------------------------------------------

Date: April 25th
Start Time: 10:45pm
Duration: 1.50 hours

Just got out of my exam in my morning class and on 2 hours of sleep I am drained. We STILL don’t have 9V batteries so I will run to Target to grab some. Am back now with 2 batteries. Plugged them in and they actually appear to work exactly like the power supply. Yay!

Cullen came in and did some soldering with my help to get the buttons working. No luck after all that. I have to go to class but we need to get all these wires wrapped up and shoved into the case ASAP for presentation in like 5 hours.

Entry 4: -----------------------------------------------------------------

Date: April 24th
Start Time: 1:00pm
Duration: 11:50 hours

I am going to get the keypad hooked up to the PCB and get the alphanumeric code running on this micro. Got all the pins hooked up and code ported over. Wow it worked first try. Thats a first this week. Very much needed win in my book.

example1
typing out message on keypad and displaying it on OLED

We need to get the buttons working. Cullen is drilling holes right now while I am setting up the interrupts for the buttons and playing around with their pinouts on the board. Assuming the buttons work properly we should be able to navigate the menu now. Cullen and Visuwanaath will go to Bechtel around 4:30 so I will work on the menu software while they are away. I’m hungry so I’ll go to Subway to work.

I’m at Subway and writing the state machine for our menu. Not really much to talk about, it’s just a huge state machine. I will head back around 6:30. Ok the entire beacon part of the menu is done. I want to wait before I do more to make sure we can even navigate what we have with buttons first.

Back in the lab now, and the other two are back. Sophie, who has been sick, just popped in and grabbed some stuff to solder, mainly the buttons. Cullen and Visuwanaath realized what I had feared. The LoRa module which was still getting powered was interfering with our RX pin coming from the breakout board. Visuwanaath scraped the trace until the chip could possibly send anything over it anymore. That fixed our issue and we can now send and receive exactly what we want every time. We snagged a TA to check off that we could interact with the LoRa module over UART, giving us our third and final PSDR. Cullen insists we need 2 hardware and 1 software at least but I checked the syllabus and the PSDR doc and it says “at least 2 hardware”. I am sure we passed ABET req but he is still freaking out about it. I know I’m right.

Cullen went up to check on Sophie. I am having more trouble with the OLED. Apparently it doesn’t work with one of our boards, but realistically we only need one to work to test the menu. I am working on the menu still and making some tweaks to the interrupts. We can only set 4 the way I’m doing it which could be an issue. However, I realized while i was writing the state machine that we never actually need to use the down arrow. Our enter button does everything that the down arrow would. This is cool because we only need to wire up 4 buttons to get all the functionality.

example1
navigating the menu being displayed on OLED

I went up to check on Sophie and Cullen because I hadn;t heard from them in an hour and a half. Sophie left and Cullen took over soldering buttons. The wires probably aren’t long enough that could give us trouble. He wrapped it up and we took the board and Case down to lab to start assembling it. Things will be a very tight fit. We barely have room for our OLED. Also, with this board, Visuwanaath realized that it only worked with the STLink plugged in. Just wonderful. This is gonna be a tight squeeze.

example1
oled hastily wired into project box

Things are coming together but we will wait until tomorrow to do the final assembly. Buttons do not work even after all the soldering. Damn. There is a missing resistor that is probably the cause of every button not working. Cullen is done soldering tonight. That's tomorrow’s issue.

We changed my code to automatically send the message after 5 characters to the other PCB Viswanaath frankensteined the LoRa module onto. WOW IT WORKS. We can successfully type out a 5 character message and send it.

example1
sending message from one beacon to another

Tomorrow we will need to get that checkoff asap and prep for the demo. In the past, things don’t like to work from day to day so I am praying they do just this once because this is so good for the demo.

example1
WE ARE GONNA PASS


Entry 3: -----------------------------------------------------------------

Date: April 23rd
Start Time: 3:00pm
Duration: 7.25 hours

In the lab with Cullen today, the first thing we want to do is get another PCB hooked up so we can both debug the LoRa module not working. We can’t find the OLED cable in our box. Nevermind we are blind. We are trying different things but getting nothing back from our LoRa module at all. We know from Viswanath's testing that we are sending the correct characters because he used the oscilloscope to check yesterday. The DMA is set up properly but doesn’t seem to be receiving data properly, despite being triggered. It’s just all 0s.

I got fed up with trying to fix it withsoftware so I quickly probed the module and saw that the GND pin is 3.3V. Uh oh. I just probed the entire ground plane under it and it is all 3.3V. UH OH. Shivam just walked by and he thought our module was fried. Cullen’s setup has the same issue; this is probably a problem on all of our boards. All our modules are probably cooked.

Cullen and I sprinted up to prof. Walter's office and explained the issue. We looked through the PCB on KiCad and he agreed there shouldn't be an issue. He noticed it was out of date and the KiCad file on our website isn’t updated. Sophie really needs to update it. We've asked her many times to upload the recent changes. Anyway he also looked at our soldering and said it should be fine. He agreed to let us use the breakout boards because otherwise we could get LoRa working which means we can’t get any other PSDRs and then we can’t graduate. I hate that it has to come to this but at least we know the breakout boards work and we know how to send messages. We can just reuse existing code. Cullen soldered on wires to the TX and RX pins so we could start testing with the breakout board. We can’t get the module working on the first try so we are gonna take a mental break for a few minutes so we don’t crash out.

example1
wires soldered on TX and RX pins for LoRa

Visuwanaath showed up just as we got back from a Discount Den run. He got the oscilloscope ready to read characters again and we saw that we were in fact sending correctly. I’m worried that the 3.3V will bleed back into the TX and RX pins and disrupt transmission.

example1
Visuwanaath tweaking settings on oscilloscope

We created a quick breadboarding solution with the LoRa breakout board attached. Cullen and I realized that the TX and RX pins were swapped on the board. Sophie named them correctly we just interpreted the silkscreen labels wrong. We couldn’t get a signal. Cullen left for Volleyball elections just as Visuwanaath showed me what signals we were getting.

example1
bits being received by LoRa breakout board

I don’t know why the 0 and 1 are almost the same voltage towards the start but it does get the job done. We are getting correct signals out of the TX and RX pins. We just confirmed that the module works and we are getting what we expect in our buffer. We can’t do anything else with LoRa tonight because we have a report due at midnight. Why did they schedule a report during the week of the demo. That is just inconsiderate to us.

I ran home where Cullen sent out what parts we wanted us to do. We finished the rough draft of the report in an hour flat. Honestly super impressive. We will need to make so much progress tomorrow with LoRa and start finalizing packaging.

Entry 2: -----------------------------------------------------------------

Date: April 22nd
Start Time: 1:00pm
Duration: 6.75 hours

I really want to get the issue of displaying arrows figured out. I also just wrapped up some other screens. I think with the exception of the arrows not being displayed the menu is done.

example1
finished menu in Squareline Studio

I again tried displaying an image to the display but it just doesn't work. Same with the transformation issue, it might just be a verison issue which I can’t fix. For now I will just use the ( < ^> v ) text arrows which sucks but whatever.

example1
tracking screen not showing arrow image

I went up to the ECE shop to give Sophie some parts she asked to be brought up and ran into Niraj. I explained the STLink issues and booting problems we’ve been having for a while now and he offered to take a look. The first thing the team wanted to tackle with his help was the issue of the micro not running code that was in flash. We tracked the issue in debug mode which was getting caught up in one of the LVGL functions. We saw it was getting caught on a HAL_Delay which Niraj said shouldn’t be an issue. I don’t think so either as we have been using them a ton this semester with no issue. He recommended nano_wait but I don’t really want to do that. We eventually looked through the system_stm32l4xx.c file which had an option to change the vector table location. We gave it a try and it actually worked.

	/*!< Uncomment the following line if you need to relocate the vector 
	table anywhere in Flash or Sram, else the vector table is kept at the 
	automatic remap of boot address selected */ 
	#define USER_VECT_TAB_ADDRESS
	
We also asked Niraj to help us out with the issue of the micro only running code when the STLink is connected. He probed around for a bit and I lost track of what he was trying, something with our nRST pin, but we eventually found out it was “ground plane dissipation”. The way he explained it was that our STLink wasn’t providing power, but it was providing a GROUND to the other side of the board. He said the ground on one side of the board was different than on the other side which was why it wasn’t running. I don’t really know how that works because our micro shouldn't need ANOTHER ground to run but whatever. I love Niraj. He is so goated. Sophie said she was going to connect our grounds on both sides of the board which will fix our issue. Once that is done we should be able to run our device wirelessly.

I played around with getting our LoRa working for a few minutes but got nowhere so that will be a tomorrow issue.

Entry 1: -----------------------------------------------------------------

Date: April 21st
Start Time: 3:00pm
Duration: 7.50 hours

Cullen, Visuwanaath, and I are in the lab today. First off, I flagged down a TA and got the OLED PSDR checked off. Now we have two so we only need to get LoRa working and we pass.

I was complaining to my teammates about how slow the refresh rate was on the display and how it would make navigating a menu difficult. Visuwanaath mentioned that maybe my clock frequency was slow. I changed it from 4 MHz to 32 MHz and wow that looks so much better, it went from taking 2 seconds to display a new screen to taking maybe a quarter of a second. I also got rid of all the unused driver functions from my driver C file.

I put stickers on the alphanumeric keypad to make it easier to type with and had both teammates give me feedback on the feel of it. Cullen wanted the delays shorter and also noticed that if you hit the backspace it would sometimes delete two or three characters. I will need to increase the post button press delays on that key specifically.

example1
stickers on keypad

After looking through the UI files I found out how to change the text that is displayed on each menu screen with a simple command. Only issue is that the screen needs to be manually refreshed in doing so. Also, given how small the OLED is, 200 characters wont fit on a single screen. 100 won’t either. 50 won’t either. Only about 30 characters can fit and that still takes up half the screen. I will need to figure out how to display different character lengths at a later time.

example1
big messages cannot fit on OLED

Sophie popped in and we talked about hardware progress. We explained that one of the boards was cooked through and through. She told us that she had stripped one of the OLED headers and that one of the PCBs was now unusable. We agreed to take some of the parts off of the board that no longer works.

We are pivoting to start testing the LoRa module. We are sending commands but getting nothing back over UART. We are fiddling with commands and the baud rate (which shouldn't need changing as the manual says 9600) but nothing is working. Visuwanaath and I are exhausted so this is a tomorrow issue. Before we left I noticed that some of the resistors weren’t soldered around the LoRa chip. Could be that they are just for the LEDs that we likely won’t need but I brought it up to Sophie over text just in case.

=============== Week 14: =================


Entry 15: -----------------------------------------------------------------

Date: April 20th
Start Time: 8:30pm
Duration: 2.25 hours

I want to take a break from the manu today so I will try to get the alphanumeric keypad working. I am wiring it up as the store page says on one of the prototypes.

example1
keypad wired to prototype

Just set up the GPIO pins on the Cube and tried a simple test to get it to print something to the OLED. It didn’t work. The wiring is incorrect on the website according to one of the reviews which also states the correct pinouts. The review was correct. I can now read the key presses. I just set up an alphanumeric function for the top left key which will be a/b/c.

	if(Keypad_Scan() == '1'){
		HAL_Delay(750);
		key = 'a';
		keyBuffer[bufferIndex] = key;
		OLED_SendString(keyBuffer);
		if(Keypad_Scan() == '1'){
			HAL_Delay(750);
			key = 'b';
			keyBuffer[bufferIndex] = key;
			OLED_SendString(keyBuffer);
			if(Keypad_Scan() == '1'){
				HAL_Delay(750);
				key = 'c';
				keyBuffer[bufferIndex] = key;
				OLED_SendString(keyBuffer);
			}
		}
	}
	
I will need to adjust the timing, because its horribly slow to type stuff out but it does work.

example1
typing test on keypad

Just coded up the rest of the keys and it can now type out messages. The delays are much better around 300 ms.

example1
comstom message typed out on keypad

I will need to have someone try this out to see if typing on the keypad feels natural because right now it feels stiff and slow. Also, none of the PCBs have the 7 pin connector soldered on so that will need to happen very soon this week.

Entry 14: -----------------------------------------------------------------

Date: April 19th
Start Time: 2:30pm
Duration: 6.25 hours

Just got to the lab, turned on the screen, and now my screen doesn’t show up anymore. Even after I flash it this is so annoying. Ok I gave it 5 mins to sit and now it works. Good grief.

I am playing around with having the screen only display black and white pixels. The way it receives the bitmap currently has much of the screen displaying the white as grey and it looks terrible. It also has white bars going through it which I can’t explain.

example1
ugly gray menu with bars

I just realized that I am receiving each pixel in the bitmap as 8 bits but the RBG565 format that is benign used is 16 bits. I changed the function and it looks a bit better but I still want to go for the black and white. I have it set so that if the 64 bit grayscale value the RBG is scaled to is over 40, it will be black and white otherwise. That looks much better. I just tried inverting the black and white and it looks so much better. It also draws less mA which is a plus. I will keep it like this.

example1
menu in black and white

The fact that the color scale isn’t even mentioned in the OLED datasheet is super weird, there are also no drivers anywhere to be found. Right now I am able to print seemingly whatever I want to the OLED but I feel like it isn’t how I’m supposed to be printing things. However it ain’t broke yet so I won’t fix it.

I’m making the menu now in Squareline studio. Sophie has to complete the User Manual today so I will finish these up and get those over to her ASAP. I’m having trouble with the image png file being too big for the STM32CubeIDE to upload onto the micro. With the uncompressed image the code push is almost 8 MB and our micro only has 2 MB of flash. I changed some settings in Squareline Studio to turn the image into a compressed binary file. No matter what I try though I can’t get any image file to show on the OLED. For now I will just use text arrows ( < ^ > v ) and then rotate them accordingly.

Another thing I’m realizing now, switching screens doesn’t work properly. It only refreshes the part of the screen that changes, but the way I’ve written my drivers, it always starts writing from the top left corner which messes everything up.

I cannot transform text and have it display to the OLED. No transformed (rotated) text ever shows up. I was trying to make text larger and smaller by transforming it but squareline studio has different font sizes so I will just use that. I had to enable settings in the LVGL config file but now I got different text sizes to display

example1
custom message being displayed with correct font size

I am trying different ways to refresh screens without the buffer issue messing everything up like I talked about earlier. I found that this works best:

	lv_disp_load_scr(ui_main_beacons);
	lv_refr_now(NULL);
	HAL_Delay(200);
	
I think I will have to edit this menu a ton in the next few days but here is every menu screen thus far:

example1
all menu screens

I sent those to Sophie and I’m going to get started writing the giant state machine to navigate the menu. I will have to finish this up another time but I think I got the logic of it down assuming the navigation buttons work.

Entry 13: -----------------------------------------------------------------

Date: April 18th
Start Time: 11:00pm
Duration: 0.75 hours

Added more journal entries to the website. These entries take way too long to put into the website. Course staff whines that we don't put effort into journals but I don't think they realize that it is in part due to the fact that these take HOURS to put into VSCode and format. Just make us keep a google doc or something this system is horrible.

Entry 12: -----------------------------------------------------------------

Date: April 18th
Start Time: 3:30pm
Duration: 7:00 hours

I am in the lab alone today and I will try to get the OLED to display the design. Currently it displays the logo but I will almost certainly have to change the bitmap function because the LVGL software spits out the bitmap in 16-bit RGB565 format but our OLED takes 4-bit grayscale. The current bitmap function I have just takes in an array and sends each byte of data to the OLED sequentially. Currently when I try to load the design I get a blank screen with two stripes being written to over and over:

example1
only two rows being written to

I changed the setting of the rows and columns, which it was setting manually. This OLED has rows from 0-63 as indices but for some reason the columns start at 0x1C so that should center the image better. Now I’m getting this three layered static:

example1
three layers of static

I tried writing the bitmap backwards and that actually gave me a screen close to what I wanted to see. The design I wanted to display was the “hello world” screen I made yesterday. This is what is being displayed now:

example1
design with black line through it

I am playing around with different styles of sending the bitmap to the OLED as data bytes. Just after writing that sentence, I kept trying new settings for almost three hours and completely forgot to write anything here but here are some of the screens I got printing:

example1
design flipped horizontally AND vertically


example1
half the design not being displayed


example1
design with bottom row missing

That last screen is super close to what I wanted, but I can’t figure out why that last row is filled with junk pixels. I'm sending the entire array it should all fill up. I am going to try adjusting the row settings because maybe its printing a row too high. That made it worse haha.

example1
design shifted too far up

Ok nothing I am trying is getting it exactly how I want and I think it’s a formatting issue with how my screen is reading data vs LVGL is sending the data. I am asking ChatGPT to give me some test screen bitmaps to find out how LVGL is sending its data. Ran the test functions and it wasn’t displaying the designs that I should have so I told ChatGPT what results I got and it identified the OLED as using “SSD1306-style paging” which I looked up and found it had a different layout than I am trying. I just corrected the test function and am getting this correct result:

example1
design being printed perfectly

This is the final working code:

	// Set the column
	void OLED_Set_Column(uint8_t start, uint8_t end) 
	{
		Command(OLED_CMD_SET_COL_ADDR);
		// Data(start);
		// Data(end);
		Data(0x1C);
		Data(0x5B);
	}

	// Set the row
	void OLED_Set_Row(uint8_t start, uint8_t end) 
	{
		Command(OLED_CMD_SET_ROW_ADDR);
		// Data(start);
		// Data(end);
		Data(0x00);
		Data(0xCF);
	}

	// Set the display window
	void OLED_SetWindow(uint8_t start_x, uint8_t end_x, uint8_t start_y, uint8_t end_y)
	{
		OLED_Set_Column(start_x, end_x);
		OLED_Set_Row(start_y, end_y);
	}

	// Draw the bitmap array onto the OLED
	void OLED_DrawBitmap(uint8_t x, uint8_t y, const uint8_t *bitmap)
	{
		OLED_Set_Column(0,0);
		OLED_Set_Row(0,0);
		Command(OLED_CMD_WRITE_RAM);
		for (int row = 0; row < OLED_HEIGHT; row++) 
		{ 
			for (int col = OLED_WIDTH - 1; col>= 0; col--) 
			{
				int index = (row * OLED_WIDTH + col) * 2 + 1;
				Data(bitmap[index]);
			}
		}
	}
	
I will need to finish up the menu ASAP so we can start working on the other functionality writing to the menu I will make but at this point I am happy getting just a single custom screen on the OLED.

Entry 11: -----------------------------------------------------------------

Date: April 18th
Start Time: 11:30am
Duration: 1.00 hours

Added current journal entries to the website.

Entry 10: -----------------------------------------------------------------

Date: April 17th
Start Time: 8:00pm
Duration: 1.75 hours

Still following the tutorial. I uploaded all the files to the CubeIDE exactly as it recommended. When building, I got tons of errors, mostly import errors with header files. Fixed those now. Progress is very slow getting this to build because there are so many files.

Next I am creating a very basic design in the Squareline studio software. I followed part two of the tutorial in creating a very basic hello world screen which I can test on our OLED to make sure the software works on our micro. I will hope to test this on the PCB OLED tomorrow but in the meantime I should be able to work on the menu screens. Our screen doesn’t have many pixels which will make the menu very compressed but oh well.

example1
basic design created in Squareline Studio


Entry 9: -----------------------------------------------------------------

Date: April 17th
Start Time: 4:15pm
Duration: 2.50 hours

Visuwanaath and I met in the lab to get the packet sending code working. I had some trouble with my OLED prototype not showing strings but it was all a typing error. Also, I enabled DMA receiving for the UART. Visuwanaath already wrote much of the packet receiving and unpacking code so we just had to move it from VSCode to the CubeIDE. That took more time than we would like to admit but it runs. Since we are now using the DMA like Cullen’s code recommended, the buffer we were printing isn't filling up until it was done receiving, which makes sense but was not what we wanted for the initialization.

We finally had the idea of setting a flag in the interrupt which would let us wait until the buffer had what we wanted before proceeding. This lets the buffer fill up with +OKs one at a time. Now we got the DMA buffer to fill up with bits and pieces of our packet but not the entire thing. It is set to circular so it should start at the beginning of the buffer if it overflows but it isn’t. Got it working and the buffer now fills with the entire packet.

example1
buffer filled with packet info

Visuwanaath wrote some more cohesive code to print packet info to the OLED once it was received and it works now.

example1
OLED on prototype displaying packet message

Next we have to test this code on the LoRa module on the PCB.

Entry 8: -----------------------------------------------------------------

Date: April 17th
Start Time: 12:30pm
Duration: 1.00 hours

Going to write the bitmap and window size functions. They are written now but i don’t know if they work. I based them off of similar functions that the tutorial mentioned. Here they are:

	// Set the display window
	void OLED_SetWindow(uint8_t start_x, uint8_t end_x, uint8_t start_y, uint8_t end_y)
	{
		// Set column address range
		Command(OLED_CMD_SET_COL_ADDR);
		Data(start_x);
		Data(end_x);

		// Set row address range
		Command(OLED_CMD_SET_ROW_ADDR);
		Data(start_y);
		Data(end_y);
	}

	// Draw the bitmap array onto the OLED
	void OLED_DrawBitmap(uint8_t x, uint8_t y, const uint8_t *bitmap)
	{
		// Set the drawing window
		OLED_SetWindow(x, x + OLED_WIDTH - 1, y, y + OLED_HEIGHT - 1);
		// Start RAM write
		Command(OLED_CMD_WRITE_RAM);
		// Calculate total bytes (each byte contains 2 pixels)
		uint16_t total_bytes = (OLED_WIDTH * OLED_HEIGHT + 1) / 2;
		// Send bitmap data
		for (uint16_t i = 0; i < total_bytes; i++) 
		{ 
			Data(bitmap[i]); 
		} 
	}
	
Still following the tutorial. I am downloading squareline studio which should be able to connect with the LVGL software easily. I will try to get the menu designs started today and finished tomorrow so Sophie can write the user manual.

Entry 7: -----------------------------------------------------------------

Date: April 16th
Start Time: 10:30am
Duration: 3.25 hours

Going to do my best to understand what Visuwanaath and Cullen have been cooking up the past two weeks. I first read this article they used to get their DMA working.

I looked through Visuwanaaths code on the Github. Seems to be the start of some very complex stuff but I understand most of it. I do need some clarifications:

    Clarifications I need from Visuwanaath
  • storeBeaconsInFlash
    • Flash erase should be after flash program
  • addBeaconToBeaconArray
    • Should check all elements before adding or changing
    • No check if array is already full
    • Strncpy with length limits instead of strcpy
  • Flash is rewritten on every write, why?
  • Packet 7 and 2 do the same thing?

Cullen’s code is pretty simple; it looks like he didn’t change much. He is now using a DMA receiver function though, which should take some load off of the CPU.

I am watching some Youtube videos now on how to implement LVGL in STM32CubeIDE. At some point they all involve uploading drivers. I’m asking ChatGPT for examples of what a driver file would look like because I couldn’t find any online for our specific OLED. Luckily, the datasheet isn’t that long and the commands are pretty straightforward and explained well. I am turning my current initialization process into a more refined driver file. I found a font file for ASCII online so I will use that. Here are the functions I currently have:

	#include "driver.h"
	#include "font.h"
	#include 
	
	SPI_HandleTypeDef *OLED_hspi;
	uint8_t OLED_buffer[OLED_WIDTH * OLED_HEIGHT / 2]; // 4-bit grayscale (nibble per pixel)
	
	// Send Command
	void Command(uint8_t cmd)
	{
		HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_RESET); // Command mode
		HAL_SPI_Transmit(OLED_hspi, &cmd, 1, HAL_MAX_DELAY);
	}
	
	// Send Data
	void Data(uint8_t data)
	{
		HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_SET); // Data mode
		HAL_SPI_Transmit(OLED_hspi, &data, 1, HAL_MAX_DELAY);
	}
	
	// Hardware reset
	void OLED_Reset(void)
	{
		HAL_GPIO_WritePin(OLED_RES_PORT, OLED_RES_PIN, GPIO_PIN_RESET);
		HAL_Delay(1); // Minimum 200us
		HAL_GPIO_WritePin(OLED_RES_PORT, OLED_RES_PIN, GPIO_PIN_SET);
		HAL_Delay(1); // Minimum 200us
	}
	
	// Initialize display
	void OLED_Init(SPI_HandleTypeDef *hspi)
	{
		OLED_hspi = hspi;
		OLED_Reset();
	
		Command(OLED_CMD_SET_SLEEP_MODE_ON); // Display off
	
		// Clock divider and oscillator frequency
		Command(OLED_CMD_SET_CLOCK_DIV);
		Data(0x91); // Divider = 1, Freq = 0x1
	
		// Set MUX ratio
		Command(OLED_CMD_SET_MULTIPLEX_RATIO);
		Data(0x3F); // 64 MUX (for 64 rows)
	
		// Set display offset
		Command(OLED_CMD_SET_DISP_OFFSET);
		Data(0x00); // No offset
	
		// Function selection
		Command(OLED_CMD_FUNC_SELECT);
		Data(0x01); // Internal VDD regulator
	
		// Set re-map (memory addressing)
		Command(OLED_CMD_SET_REMAP);
		Data(0x14); // Horizontal increment, column address 0 mapped to SEG0
		Data(0x11); // Enable COM split odd/even
	
		// Master contrast current control
		Command(OLED_CMD_MASTER_CONTRAST_CURRENT);
		Data(0x0F); // Maximum contrast
	
		// Set contrast current
		Command(OLED_CMD_SET_CONTRAST_CURRENT);
		Data(0x9F); // Medium contrast
	
		// Set phase length
		Command(OLED_CMD_SET_PHASE_LENGTH);
		Data(0xE2); // Phase 1 = 15 DCLKs, Phase 2 = 5 DCLKs
	
		// Set pre-charge voltage
		Command(OLED_CMD_SET_PRECHARGE_VOLTAGE);
		Data(0x1F); // ~0.6*VCC
	
		// Set VSL
		Command(OLED_CMD_SET_SECOND_PRECHARGE);
		Data(0x08); // Second precharge period
	
		// Set VCOMH voltage
		Command(OLED_CMD_SET_VCOMH_VOLTAGE);
		Data(0x04); // ~0.8*VCC
	
		// Set display mode to normal
		Command(OLED_CMD_DISP_MODE_NORMAL);
	
		// Clear display
		OLED_Clear();
	
		// Turn on display
		Command(OLED_CMD_SET_SLEEP_MODE_OFF);
	}
	
	// Clear display buffer
	void OLED_Clear(void)
	{
		memset(OLED_buffer, 0, sizeof(OLED_buffer));
	}
	
	
	// Update display from buffer
	void OLED_Update(void)
	{
		// Set column address range (0-127)
		Command(OLED_CMD_SET_COL_ADDR);
		Data(0x00); // Start column
		Data(0x7F); // End column
	
		// Set row address range (0-63)
		Command(OLED_CMD_SET_ROW_ADDR);
		Data(0x00); // Start row
		Data(0x3F); // End row
	
		// Write RAM command
		Command(OLED_CMD_WRITE_RAM);
	
		// Send entire buffer
		for (uint32_t i = 0; i < sizeof(OLED_buffer); i++) 
		{ 
			Data(OLED_buffer[i]); 
		} 
	} 
	
	// Set pixel in buffer void
	OLED_SetPixel(uint8_t x, uint8_t y, uint8_t brightness) 
	{ 
		if (x>= OLED_WIDTH || y >= OLED_HEIGHT)
		{
			return;
		}
	
		// Each byte contains two pixels (4 bits each)
		uint32_t index = (y * OLED_WIDTH + x) / 2;

		if (x % 2 == 0)
		{
			// Even pixel - upper nibble
			OLED_buffer[index] = (OLED_buffer[index] & 0x0F) | (brightness << 4); 
		} 
		else { 
			// Odd pixel - lower nibble
			OLED_buffer[index]=(OLED_buffer[index] & 0xF0) | (brightness & 0x0F); 
		} 
	} 
	
	// Draw character at specified position with given brightness void 
	OLED_DrawChar(uint8_t x, uint8_t y, char ch, uint8_t brightness) 
	{ 
		// Check if character is in font range 
		if (ch < FONT_START || ch> FONT_END)
		{
			return; // Character not in font
		}
	
		// Get pointer to character data
		const uint8_t *char_data = font_5x7[ch - FONT_START];

		// Draw each column of the character
		for (uint8_t col = 0; col < FONT_WIDTH; col++) 
		{ 
			uint8_t col_data=char_data[col]; 
			
			// Draw each row of the column 
			for (uint8_t row=0; row < FONT_HEIGHT; row++) 
			{ 
				if (col_data & (1 << row)) 
				{ 
					SSD1322_SetPixel(x + col, y + row, brightness); 
				} 
				// else: leave pixel as background (don't clear it) 
			} 
		} 
	} 
	
	// Draw string
	void OLED_DrawString(uint8_t x, uint8_t y, const char *str, uint8_t brightness) 
	{ 
		while (*str) 
		{
			OLED_DrawChar(x, y, *str++, brightness); 
			x +=6; 
			
			// Advance cursor (adjust based on font width) 
			if (x>=OLED_WIDTH - 6)
			{
				x = 0;
				y += 8; // Move to next line (adjust based on font height)
			}
		}
	}
	
	// Draw line (Bresenham's algorithm)
	void OLED_DrawLine(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t brightness)
	{
		int16_t dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1; 
		int16_t dy = -abs(y1 - y0), sy=y0 < y1 ? 1 : -1; 
		int16_t err = dx + dy, e2; 
		
		while (1) 
		{ 
			OLED_SetPixel(x0, y0, brightness); 
			if (x0==x1 && y0==y1)
			{
				break;
			}
			
			e2 = 2 * err; 

			if (e2>= dy)
			{
				err += dy;
				x0 += sx;
			}
			
			if (e2 <= dx) 
			{ 
				err +=dx; 
				y0 +=sy; 
			} 
		} 
	} 
	
	// Draw rectangle 
	void OLED_DrawRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t brightness) 
	{ 
		OLED_DrawLine(x, y, x + w - 1, y, brightness); 
		// Top 

		OLED_DrawLine(x, y + h - 1, x + w - 1, y + h - 1, brightness); 
		// Bottom

		OLED_DrawLine(x, y, x, y + h - 1, brightness); 
		// Left 

		OLED_DrawLine(x + w - 1, y, x + w - 1, y + h - 1, brightness); 
		// Right 
	} 
	
	// Fill rectangle 
	void OLED_FillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t brightness) 
	{ 
		for (uint8_t i=x; i < x + w; i++) 
		{ 
			for (uint8_t j=y; j < y + h; j++) 
			{ 
				OLED_SetPixel(i, j, brightness); 
			} 
		} 
	} 
	
	// Turn display on 
	void OLED_DisplayOn(void) 
	{
		Command(OLED_CMD_SET_SLEEP_MODE_OFF); 
	} 
	
	// Turn display off 
	void OLED_DisplayOff(void) {
		Command(OLED_CMD_SET_SLEEP_MODE_ON); 
	}
	
The tutorial says that there need to be two functions that LVGL will use. One for setting the window and one for drawing the bitmap. It seems that I have the start of the bitmap but tomorrow I will need to get that window function written.

Entry 6: -----------------------------------------------------------------

Date: April 16th
Start Time: 3:00pm
Duration: 2.75 hours

Sophie, Visuwanaath and I are investigating the power issue with the OLED. We couldn’t get the checkoff. Sophie soldered the wires but it didn’t help. Actually it doesn’t even turn on now.

Dr. Walters came over and we showed him the issue. He immediately noticed the 1.3 Amps that it was drawing and said it was a short. We told him the micro still booted fine but he said that it should only be drawing a few mA. I touched the micro and yea it was like scalding so definitely a short. I just wish we knew that earlier before I sunk like 4 hours into “debugging” this OLED when it was a micro problem. Sophie also showed off the buck converters that weren’t working. She said that yesterday they were but now they weren’t. We chatted a bit more about some other issues like the STLink and such. Just after they left Sophie crashed out and left. Totally justified ngl I’d be pissed.

Visuwanaath and I will work on the LoRa software as best we can until the hardware decides to work again. I am setting up the prototype with a new folder in the CubeIDE. It’s not working even though it's the exact same code. Been changing settings for like 20 mins now and it still won’t work. We might have a second crashout in the group if this doesn’t work soon. Ok finally it turned on. Visuwanaath showed me around the github repo and what he and Cullen have done. He told me to look over a document about how the DMA works also so I will do that tonight.

Entry 5: -----------------------------------------------------------------

Date: April 16th
Start Time: 11:45am
Duration: 0.50 hours

Going to keep battling that issue I left off yesterday. Power seems to be the primary issue as the 3.3V and GND cables keep shifting every time I touch the PCB which gives a different result. Changing the prescaler doesn’t fix anything in the IOC file. Nothing I change fixes anything so I think the software works fine. It's just that the power to the board is fluctuating or something. I will talk to Sophie later in the lab to see if we can get a buck converter to power the micro and the OLED to give some consistency.

Entry 4: -----------------------------------------------------------------

Date: April 15th
Start Time: 4:30pm
Duration: 4.50 hours

Cullen and I are going to test the OLED today after class. We are having problems with the USB connection. The OLED only seems to turn on when the STLink is connected which is weird because it doesn’t provide any power. Yup checked multiple times and it has to be power cycled WITH the USB plugged in. That is so weird. We are wiring up the STLink manually with wires for each pin and pulling them out one by one. After getting to the last pin, we pulled it out and the OLED is still on. Ok I guess the problem resolved itself. The definition of insanity is trying the same thing and expecting different results. We are trying the same thing AND getting different results. What is happening?

We are moving on to that tutorial I found from the article about setting up the simulator. Got everything set up now. I should be able to design a screen now. Actually getting it onto the OLED through the CubeIDE will be a pain in the ass I fear though.

I don’t really want to work on the design today so I will try to figure out how the OLED displays its pixels. I am getting code from the manufacturer of the OLED to display their logo. I tried implementing it and it still just displays static. It seems that the OLED is capable of displaying 16 shades from white to black, but in the code they only use black and white, which makes sense for a logo. I am spending forever just making random changes and not getting anywhere. Just static.

example1
OLED showing static

I got it to display the logo for a split second by removing the delay between SPI packets. That might be an issue I will have to explore more. Perhaps the HAL command doesn’t play nice with HAL delays.

example1
OLED displaying manufacturer logo

I cannot get the logo to stay. Sometimes it just prints halfway then starts spamming random pixels. I suspect that it might be a power issue. Something to note, after flashing the code it doesn;t start displaying code immediately, I have to power cycle it. Setting the CS pin myself doesn't change anything. Setting RAM to read only after displaying doesn't fix it. I think the RAM is getting set but then the SPI just keeps sending data which it uses to overwrite the image. Don't have any proof yet for that hypothesis. Will work on getting an image to consistently display tomorrow.

Entry 3: -----------------------------------------------------------------

Date: April 15th
Start Time: 1:30pm
Duration: 2.75 hours

I am going to start where I left off yesterday and continue finding out why this OLED doesn’t work. The power issue is the obvious first thing I need to look at.

I am testing on the pins coming out of the OLED and it seems that the OLED isn’t getting power or ground actually. I checked the cable and it seems that that is the issue. The cable is not supplying power which means that I probably put it in wrong. I looked up how to insert the cable and I think I just had it upside down so I feel stupid. Now, the cable is getting 3.3V to the OLED but the 3.3V pin on the OLED isn’t getting powered.

example1
OLED hooked up to PCB

Sophie walked in and I showed her the issue. She was confused that I was putting my cable in upside down but I told her that was the only way it was getting power to the OLED. I realized that maybe the connector on both the PCB and OLED were different and after I checked it out I realized that the connector on the OLED needs the pins facing towards the board and the connector on the PCB needs pins facing away from the board. This is an issue because if we were to flip it the correct way the pins would be switched. Luckily Sophie just said she has the other version of the connector. She said that she could get me a new version of the board with the correct connector soon so that I could keep testing the OLED.

She went upstairs to solder so until class at 4:30 I will look up how to use that graphical interface software I found earlier this semester for the software formalization report. I am looking into the LVGL software and there is a simulator I can set up so I can see what my code does before it gets put onto the OLED. I am going through github repos right now trying to figure out how to install it.

Sophie just came back down with the proper header soldered onto one of the boards. I plugged in all the cables again and OH MY GOD IT WORKS LETS GOOOOOOOO. Very excited that the code is being downloaded properly. The OLED turns on which historically has been the hardest part of programming one this semester.

example1
OLED turning on

I will keep researching how to set up that simulator. I found a tutorial that said it was only 4-clicks but gave me some errors. I found an article that will help me set it up on VSCode which is exactly what I need. I will work on that just after class.

Entry 2: -----------------------------------------------------------------

Date: April 14th
Start Time: 3:30pm
Duration: 3.25 hours

Sophie and Cullen are both in the lab with me now and we are talking about all the booting issues we’ve been having. Sophie brought us two PCB’s with wires soldered to BOOT0 so we could test different boot modes. I brought up the possibility that the STLink could be the issue. Since our NRST pin isn’t connected from the STLink pins to the micro, I’m worried it is trying to do a reset and failing and therefore causing our code to not work. Sophie said that shouldn’t be a problem but I still worry.

Cullen looked through the reference manual while I was probing and found that flashed code should be stored at address 0x0800000 in memory. We checked it and it wasn’t blank, meaning we probably pushed good code to flash. We are both looking through the reference manual now to see if there is anything about the booting modes. We found this chart:

example1
booting options from micro reference manual

We have only tried to set BOOT0 to ground but it seems there are other settings in software we can set to change the boot modes. We are looking at how to change those. Those option bytes cannot be set in the CubeIDE according to Google but can be set in the STM32CubeProgrammer software. Hopefully we don’t need to download more software. Cullen found that the reference manual tells us what address the bytes are set at, address 0x40022000, so we can see what they currently are. Since the nBOOT0 pin is high and the nSWBOOT0 pin is low, it says that we should already be booting into flash.

example1
looking at registers of micro in debug mode

Cullen and I are going to test one of the newly soldered micros to see if changing the boot0 pin matters. According to the chart, it shouldn’t matter. We hooked everything up and will test the PCB with BOOT0 pulled to ground and pulled up to 3.3V. While we we’re setting this up, we talked to a TA about what our issue might be and told him about the error we were having and he told us to talk with team 16 or with prof. Walters. Both pulling BOOT0 high and low doesn’t change anything which is very concerning.

example1
debugging the pcb

Cullen realised that I was setting the pins as pull-up pins, which we learned only pulls the pins high if they are GPIO inputs, and we had them set as outputs. I feel kinda dumb but it's a learning experience for sure. We are now getting voltage on the pad. We are swapping to the old board to see if the code works. The old board doesn’t work, so I think it's genuinely broken somehow. We will continue testing on the new board. Pulling BOOT0 to ground seems to work better than 3.3V (even though it shouldn’t matter) so we'll roll with that but it still gives some errors.

I set up the OLED now that the code works. It didn’t turn on. The OLED isn’t getting voltage from the power pin and the ground pin doesn’t stay at 0V very well. I will diagnose this problem more tomorrow but I think it's a connection problem with the cable.

Entry 1: -----------------------------------------------------------------

Date: April 14th
Start Time: 10:30am
Duration: 1.50 hours

I am in the lab alone and am going to see if maybe the PCB I'm testing could have an issue. I will swap it out for a different PCB and test that micro. I just did a quick test on the current PCB and no surprise it still doesn’t work. I will swap it out for the new PCB. The new PCB is actually an old PCB that Sophie soldered but that we aren’t going to use anymore. Wiring up the new one now. It doesn’t have a programming header so I am going to wire them to the STLink with wires. Not sure if this is perfect but it will have to work.

example1
new PCB wired up to power supply

The STLink wires surprisingly let us code the micro with no issues but I am still not getting a response from the micro. I am just trying to pull up a pin so that the touchpad should be 3.3V. It shouldn’t be anything that micro couldn’t do easily if it worked.

Sophie came down, and I explained the situation with the BOOT0 pin that I learned about on Friday. She said that if it was hovering around 100mV like I measured it around then it should be ground anyway but that she could solder a wire to the pin so we can ground it to be safe. She also said to be careful when putting a wire to the pin directly, like I was doing to test the new micro, as holding the wrong pins to ground could destroy the micro.

Well, in any case, the new PCB doesn't work either so I am now very worried about getting code to run. It could be that we are booting into system memory and trying to run that. I don’t really know where to go from here but I will keep trying to diagnose this issue.

=============== Week 13: =================


Entry 6: -----------------------------------------------------------------

Date: April 13th
Start Time: 1:00pm
Duration: 5.75 hours

In the lab today alone. I am going to work on getting the OLED working today. I was getting frustrated trying to get the PCB to boot on Friday so I will work on this to get my mind off of things. Since the PCB doesn’t work and the PCB is the easiest way to program the OLED, I will have to improvise. Yesterday while I was lounging around I thought of possibility of just taping the wires to the OLED cable and just using on of the prototypes to send the initialization commands so I will use my ECE 362 breakout board to send the SPI initialization commands to the OLED to see if it will turn on.

I just built the prototype by using painters tape to tape the SPI wires to the pins on the wire. This is probably the most scuffed breadboarding job I have ever done so I’m curious if this will work.

example1
SPI wires from breakout board taped to OLED cable

The initialization code didn’t work so I am wiring it up to the oscilloscope to make sure SPI is sending data properly. The oscilloscope doesn’t seem like it is catching any SPI signals but I could just have it on the wrong settings. I hooked it up to the old OLED to see if the SPI works.

example1
both OLEDs attached to same SPI wires

The old OLED, which was hooked up to the same SPI signals works fine, so I will pretend that the signals are all correct for the time being. I am going to keep trying to make small changes until the new OLED works. I am also going to switch from the 362 board to the board we’ve been using for prototyping cause the 362 board is pissing me off with its finicky functionality. Sometimes, pins just don’t go high that I’m setting. I’ve now wired up all the OLED pins again. Ok it just flashed on for a second but I don’t know what I did. I think that means the code is fine if it can turn on like that.

Ok I actually got the new OLED to turn on long enough to get a picture. I have to put pressure on the wires for it to happen though, like A LOT of pressure. Probably points to a connectivity issue but that was kinda obvious given the setup.

example1
pushing down wires to get OLED to turn on

I think I narrowed it down to just a few pins. The power pins and the Data Command pin aren’t held super tight against the cable by the tape, so if I put pressure on just those three pins the OLED turns on.

I have to go now but I am relieved that the OLED showed signs of life, even if it was just for a second and only displaying static. I cannot reasonably program it with this setup, but at least we can use this code once we get our actual PCB working. Now we just need to get code to run on our PCB, which is terrifying to me right now.

Entry 5: -----------------------------------------------------------------

Date: April 11th
Start Time: 3:00pm
Duration: 1.75 hours

I am going to start from scratch today. I made a ton of setting changes to the point where I don’t know what I did anymore so I will just start a new project and go from there. Just set everything up with the serial wire mode and set a test pin as pull up. Got no signal.

I keep getting the error “Break at address "0x1fff34c8" with no debug information available, or outside of program code.” which Google says could be caused by a floating BOOT0 pin. I am probing the pin now and it is getting 100mV. That isn’t a ton but it’s still more than the other pins which without being set are 1-8mV. I suspect that this is the problem and we will have to ground this wire. Google says either wire it straight to ground or with a 10kOhm resistor. I will solder a wire and a 10kOHM resistor together but I don’t trust myself to solder a wire to such a small pin on the micro. I really hope Sophie can.

example1
Soldering a wire and resistor together

I called Shivam over to get his opinion and he said the same thing and that it’s weird the pin isn't grounded already. I will have to convince Sophie to help me with soldering that wire next.

Entry 4: -----------------------------------------------------------------

Date: April 10th
Start Time: 4:30pm
Duration: 2.75 hours

Cullen, Visuwanaath, and I are in the lab after class. They are working on LoRa and I am still trying to push code to this stupid micro. During class I was looking through the schematic and realized that I should be setting the SYS_JTMS-SWDIO and SYS_JTMS-SWCLK pins on the micro. Now I’m confused how we are expected to set the programming pins of the micro only after we program it. I hope they 're already set up prior to shipping because that would not be fun. I just looked it up and apparently the SWD interface is already set up.

I am going to write a script to see if I can send power to a touchpoint. That didn’t work so I don’t think our code is making it to the micro. Going to look up some things I can do to change that. Since our reset pin isn’t connected from the header to the micro, someone on a forum recommended changing the reset behavior to none. I’m looking up what the “System Wake Up” setting should be. Google says it should be preset 2 because we are using a serial wire and just the two pins to download our program.

example1
PCB set up for probing different pins

I’m just going to keep trying new things until this code changes something. Don’t know how long that will take but hopefully it will get done this week.

Entry 3: -----------------------------------------------------------------

Date: April 10th
Start Time: 2:00pm
Duration: 2.50 hours

I’m joining Cullen in the lab. He is working on getting the DMA set up so we can send and receive LoRa messages without using the micro. I will work on getting the OLED to connect with the micro and turn on. Before I do that I want to see what Cullen is up to so I am going to see what his progress is. He is having some trouble getting the prototype hooked up to the lab computer but I’m sure he’ll figure that out soon.

I got the OLED out with its cable Looking through the datasheet right now to see what bytes I need to send to turn it on. I am writing the initialization code right now. The code calls for sending both data packets and command packets. I will just assume they are the same thing. Pushing the code didn’t do anything. Looking back at the datasheet right now. I might be stupid because I didn’t realize the D/C pin is what differentiates data vs command packets.

	void OLED_WriteCommand(uint8_t cmd) {
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET); // DC = 0 for command
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET); // CS low
		HAL_SPI_Transmit(&hspi2, &cmd, 1, HAL_MAX_DELAY);
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_SET); // CS high
	}

	void OLED_WriteData(uint8_t data) {
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET); // DC = 1 for data
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET); // CS low
		HAL_SPI_Transmit(&hspi2, &data, 1, HAL_MAX_DELAY);
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_SET); // CS high
	}

	void OLED_Init(void) {
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11, GPIO_PIN_RESET); // RESET low
		HAL_Delay(1);
		HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11, GPIO_PIN_SET); // RESET high
		HAL_Delay(1);

		OLED_WriteCommand(0xAE); //display OFF
		OLED_WriteCommand(0xB3); //set CLK div. & OSC freq.
		OLED_WriteData(0x91);
		OLED_WriteCommand(0xCA); //set MUX ratio
		OLED_WriteData(0x3F);
		OLED_WriteCommand(0xA2); //set offset
		OLED_WriteData(0x00);
		OLED_WriteCommand(0xAB); //function selection
		OLED_WriteData(0x01);
		OLED_WriteCommand(0xA0); //set re-map
		OLED_WriteData(0x16);
		OLED_WriteData(0x11);
		OLED_WriteCommand(0xC7); //master contrast current
		OLED_WriteData(0x0F);
		OLED_WriteCommand(0xC1); //set contrast current
		OLED_WriteData(0x9F);
		OLED_WriteCommand(0xB1); //set phase length
		OLED_WriteData(0xF2);
		OLED_WriteCommand(0xBB); //set pre-charge voltage
		OLED_WriteData(0x1F);
		OLED_WriteCommand(0xB4); //set VSL
		OLED_WriteData(0xA0);
		OLED_WriteData(0xFD);
		OLED_WriteCommand(0xBE); //set VCOMH
		OLED_WriteData(0x04);
		OLED_WriteCommand(0xA6); //set display mode
		OLED_WriteCommand(0xAF); //display ON
	}
	
The code still doesn’t work. I just probed the OLED power pins and it is getting 3.3V so it’s not a power issue. I think the micro either isn’t sending the correct packets or it’s not being programmed at all. Probing it tells me it’s getting power but it doesn’t seem to be sending anything. Hopefully the clips I’m using to hold the PCB up aren’t causing any issues but that would be a stretch.

example1
PCB about to be probed

I have to go to class now but this is very concerning if we can’t program the micro. Next step is obviously to figure out why we can't push code.

Entry 2: -----------------------------------------------------------------

Date: April 9th
Start Time: 3:30pm
Duration: 2.75 hours

The whole team is in the lab today and prof. Walters came over right away to talk with us. We talked about the duplicate order problem which he told us not to worry about for the time being. We discussed some of the worries about connection with the micro and some of the troubles we’ve had with the STLink. I’m still worried about it. We could have the best software in the world but if we can’t push it to the micro we’re cooked.

Sophie has been soldering a ton and if I can be honest, is making a huge mess everywhere. The team might be able to work in chaos but I can’t. I will spend the day today cleaning up the lab station.

example1
Dirty lab before


example1
Clean lab after

That took way longer than I thought. I had to put away lots of unused prototyping parts. I also threw away a lot of packaging. I organized all of our ordered parts into their separate boxes and separated our old PCBs from our new ones. I also just put away many many unused cables we just had lying around. I feel bad that I didn’t do any actual work today but I feel a whole lot better about my productivity at this desk this week. Tomorrow I will start work on the OLED code.

Entry 1: -----------------------------------------------------------------

Date: April 8th
Start Time: 5:30pm
Duration: 1.75 hours

Cullen and I are in the lab and plan to work on getting the lora function written now that we know how to send data. Sophie just asked if someone could write a script to blink the heartbeat LED on the pcb to see if our micro could have code pushed to it. I will work on that instead.

Sophie used the same programming header as the ECE 362 dev board which is fine except that from previous testing, it does not work with the STM32CubeIDE. I will try to use the real (non bootleg) STLink V2. I am wiring that up to the 2x5 cable we will use.

example1
Real STLink wired up

I am going to build a prototype with the 362 board just to see if the STLink works. Then I’m going to write a simple script to turn on an LED. Here is the prototype:

example1
Prototype with ECE 362 microcontroller

It doesn’t work. This stupid (real) STLink hasn’t worked a single time. I'm sick of it. I will try to find a way to use the fake STLink. I found this Youtube video which got the (fake) STLink to push the script:

example1
LED lighting up

Now that we know we can push code. I will try to flash the heartbeat LED on the actual PCB so we know if the micro works or not. Since we don’t have a buck converter soldered onto this prototype yet, I am using the power supply to provide the voltage to everything.

example1
PCB being powered by power supply

I am writing another simple script to just turn on the heartbeat LED. The code I just flashed didn’t turn on the LED so I am going to probe everything to figure out what the issue is. It seems that the Resistor on the same trace is getting power, which means the micro is getting the code and setting the proper pin. That is a relief. After probing the trace, it looks to me like the LED isn’t getting power at all, which points to a soldering problem or a faulty LED. I will have to concult Sophie about how to resolder an LED next if that is the case.

=============== Week 12: =================


Entry 4: -----------------------------------------------------------------

Date: April 3rd
Start Time: 7:00pm
Duration: 4.50 hours

I’m guessing I won’t have a lot to write about in the journal about part two of this report. Whichever TA is reading this, if you want to know what I worked on today, read the analysis report, I’m not going to rewrite everything here.

I copied all schematic diagrams from our midterm design presentation and will look for anything that could go wrong and what effect it could have on the usability of the device and the safety of the user. I think some changes have been made since then, but nothing that would be a safety concern.

I just reached out to Sophie about the buck converter because I don’t know what each individual capacitor and resistors do. She just responded saying that the worst that any discrete component could do was cause the output voltage to be incorrect, which would cause our design to work but not harm the user. Unless the voltage causes the device to get too hot, which I should consider now that I think about it. Just need to wrap the second half up then I can submit.

Entry 3: -----------------------------------------------------------------

Date: April 3rd
Start Time: 12:30pm
Duration: 3.25 hours

I am continuing to work on the safety and reliability report. I am struggling to find the other variables as there isn’t an exact fit for our micro and I have to look up what everything means. This manually is so outdated nothing from our current micro matches exactly what is in the handbooks tables. Nowhere in the manual does it state how many logic gates our micro has.

I’m having trouble with our LoRa module. It is made up of many smaller components withing its packaging. Nothing, except the included micro has a section in the handbook so I will just do the analysis for the micro inside, the STM32WLE5CCU6.

Moving onto the magnetometer now. Don’t know what type of microelectronic this would fall under in the military handbook. It is labeled as an IC but there isn’t a section for those, at least none obvious to me. I will just use the same formula for microcontrollers for this module.

Finished up the reliability analysis and the summary, and later I will have to finishe up the second half of the report.

Entry 2: -----------------------------------------------------------------

Date: April 2nd
Start Time: 3:30pm
Duration: 3.75 hours

Cullen, Visuwanaath, and I are in Manlab today. Cullen and I want to get the two prototypes to communicate over LoRa so we are debating which sections of our code work and which don’t. Cullen is working on the initialization, and I copied his code into my IDE and am trying to figure out why his code works. He is continuously setting both the transmit interrupt and the receive interrupt. His code does allow my prototype to communicate with my LoRa module, but we don’t yet know in which loop iteration things happen, which is concerning. Ideally, we only want to activate each interrupt once and make that into a function.

I am going to start helping him with the lora initialization function, where we have to set the address, network ID, and some other details. We should be getting a “+OK” response back when each of the 4 initialization commands is sent. Our current implementation has a buffer that is set up to receive data sent back from our lora module, including the “+OK” responses.

We are getting the first +OK, but the second doesn’t display on my prototype. I figured out that in the buffer, after the first +OK is written, the second is written later in the buffer just after the first. Even though I tried clearing the buffer after getting the first response, the bits are clear, but the receive HAL function still doesn’t write to the start of the buffer. I am looking online for a solution to this problem, but all the solutions just tell me to use memset, which I already do. I am going to worry about this another time because we are at least getting the correct responses. For now, the buffer fills up with the +OK messages.

example1
+OK messages in the buffer when printed

Cullen and I want to get the two prototypes communicating with each other. Together we are setting up his code to transmit a message and mine to receive it. I am just displaying the entire buffer and hoping that his message will eventually show up. We are having some timing problems where he is sending before mine is ready to receive which messes up my initialization procedure. After a few tries we just got it working.

example1
Message sent from Cullen's prototype to mine

We both have to leave lab now but here is the code I currently have for receiving a message:

	void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
		// memset(buffer, 0, sizeof(buffer));
		// huart2.pRxBuffPtr = buffer;
		HAL_UART_Receive_IT(&huart2, buffer, sizeof(buffer));
	}

	void LoRa_init(){
		char displayBuffer[100];
		uint8_t address[16] = "AT+ADDRESS=110\r\n";
		uint8_t network[16] = "AT+NETWORKID=3\r\n";
		uint8_t band[19] = "AT+BAND=915000000\r\n";
		uint8_t parameter[23] = "AT+PARAMETER=12,7,1,4\r\n";
		
		memset(buffer, 0, sizeof(buffer));
		HAL_UART_Receive_IT(&huart2, buffer, sizeof(buffer));
		
		// memset(buffer, 0, sizeof(buffer));
		memset(displayBuffer, 0, sizeof(displayBuffer));
		HAL_Delay(1000);
		HAL_UART_Transmit(&huart2, address, sizeof(address), 100);
		// while(buffer != "+OK\r\n");
		HAL_Delay(500);
		snprintf(displayBuffer, sizeof(displayBuffer), "Buffer1: %s", buffer);
		OLED_SendString(displayBuffer);
		
		// memset(buffer, 0, sizeof(buffer));
		memset(displayBuffer, 0, sizeof(displayBuffer));
		HAL_Delay(1000);
		HAL_UART_Transmit(&huart2, network, sizeof(network), 100);
		// while(buffer != "+OK\r\n");
		HAL_Delay(500);
		snprintf(displayBuffer, sizeof(displayBuffer), "Buffer2: %s", (char*)buffer);
		OLED_SendString(displayBuffer);
		
		// memset(buffer, 0, sizeof(buffer));
		memset(displayBuffer, 0, sizeof(displayBuffer));
		HAL_Delay(1000);
		HAL_UART_Transmit(&huart2, band, sizeof(band), 100);
		// while(buffer != "+OK\r\n");
		HAL_Delay(500);
		snprintf(displayBuffer, sizeof(displayBuffer), "Buffer3: %s", (char*)buffer);
		OLED_SendString(displayBuffer);
		
		// memset(buffer, 0, sizeof(buffer));
		memset(displayBuffer, 0, sizeof(displayBuffer));
		HAL_UART_Transmit(&huart2, parameter, sizeof(parameter), 100);
		// while(buffer != "+OK\r\n");
		HAL_Delay(1000);
		snprintf(displayBuffer, sizeof(displayBuffer), "Buffer4: %s", (char*)buffer);
		OLED_SendString(displayBuffer);
	}
	
Cullen and I will have to turn this into a function at a later point so that packets can be sent between the two modules.

Entry 1: -----------------------------------------------------------------

Date: April 2nd
Start Time: 1:15pm
Duration: 1.25 hours

I am working on the Reliability and Safety report today. The components that are most likely to fail are the micro, magnetometer, GPS module, and LoRa chip. I plan to use the lambda formula for microelectronic circuits seen in the lecture. I am looking through the military handbook for C1 and C2 values for the micro. This handbook seems out of date because it only has flash values in the KB ranges, whereas ours has 4 MB of flash. I found C1 in section 5.1 and C2 in section 5.9 but I will still have to find the rest of the values later.

=============== Week 11: =================


Entry 3: -----------------------------------------------------------------

Date: March 27th
Start Time: 5:30pm
Duration: 2.50 hours

I attended the soldering workshop just after class today where I learned how to drag solder. Sophie is already an expert at it and I hear Cullen did well so I will likely not need to solder anything but it’s good to know.

example1
Soldering a chip onto a pcb during the workshop

I kept trying to get my code working but no matter what I tried I just couldnt get it working. Cullen and I plan to meet next week to figure out how he got his to work and why my code doesn’t do the intended operations. Here is what I have so far:

	memset(buffer, 0, sizeof(buffer));
	HAL_UART_Receive_IT(&huart2, buffer, sizeof(buffer)); // Non-blocking RX

	while (1){
		OLED_SendString(waiting);
	
		uart_tx_done = 0;
		HAL_UART_Transmit_IT(&huart2, message, sizeof(message));
	
		while (!uart_rx_done){
			OLED_SendString(waiting);
		}
	
		if (buffer[0] == '+') {
			OLED_SendString(success);
		} else {
			OLED_SendString(failed);
		}	
	}

	void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
		uart_tx_done = 1;
		OLED_SendString(tx_done);
	}
	
	void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
		uart_rx_done = 1;
		OLED_SendString(rx_done);
		HAL_UART_Receive_IT(&huart2, buffer, sizeof(buffer));
	}
	


Entry 2: -----------------------------------------------------------------

Date: March 27th
Start Time: 2:30pm
Duration: 2.00 hours

I am working on getting the LoRa to verify a send. To do this, we are sending a hal function to transmit the function and a hal function to receive it. Both functions are interrupts which need extra interrupt handling code to use. I am understanding how each of them work currently. Now I am proceeding to not understand how Cullen got his functions “working” as he seems to be setting his interrupts in the wrong order. Here is his code:

	uint8_t message[10] = "AT+MODE?\r\n";
	uint8_t buffer[10];

	while (1) {
		HAL_UART_Transmit_IT(&huart2, message, sizeof(message));
		HAL_Delay(1000);
		HAL_UART_Receive_IT(&huart2, buffer, sizeof(buffer));
		if (buffer[0] == '+') {
			OLED_SendString(buffer);
		} else {
			OLED_SendString("Waiting for LoRa...");
		}
	}

	void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
		HAL_UART_Receive_IT(&huart2, buffer, sizeof(buffer)); //You need to toggle a breakpoint on this line!
	}
	
I cannot get my code to work, even with correct ordering. I even tried his code but it did not work on my prototype. I will have to meet with him to see if it was ever actually working.

Entry 1: -----------------------------------------------------------------

Date: March 26th
Start Time: 3:30pm
Duration: 2.50 hours

We are in the lab for ManLab today and the first thing on the agenda is getting the LoRa modules working. I am wiring up my prototype to include the LoRa module just like the other and setting it up in the IDE.

example1
Wiring up the LoRa module for testing

I was planning to start on that today but Visuwanaath and I got sidetracked when Cullen started asking about how many bytes we would need for each packet. We started writing out what info, with their respective number of bytes, we would need for each packet. We realized that for message packets we couldn't send 300 characters within the allotted 240 byte sending limit. We will need to ask Prof. Walters if we can lower the number of characters on our PSDR from 300 to 200 so that we don’t have to deal with sending two packets per message. We then got to talking about how many of each packet we would have to send for each functionality. We quickly realized that our “time to live” proposal would result in hundereds of messages being sent between all beacons on a network just to maintain a nearby beacons list on each device. Visuwanaath and I decided that a graph storing nearby beacons would be much easier than forwarding those same packets a thousand times.

example1
Printed PCB in project box

We also found an edge case to think about. If a beacon is on the nearby beacons graph and it moves out of range, we will have to delete if out of the graph and research the graph for another path the beacon can be reached. See the right side of the above picture to see our notes on that. Next we will need to get the LoRa functions working quickly so that we can worry about the data structures part of the software. We can also solder the lora module onto the PCB and start testing there.

=============== Week 10: =================


NO WORK DONE OVER SPRING BREAK


=============== Week 9: =================


Entry 5: -----------------------------------------------------------------

Date: March 13th
Start Time: 3:00pm
Duration: 1.00 hours

Added all pics and journal entries to the website.

Entry 4: -----------------------------------------------------------------

Date: March 12th
Start Time: 3:30pm
Duration: 5.75 hours

The team is in the lab now. Cullen and I plan to get a coherent message on the OLED today. The goal being to send messages between two prototypes over LoRa then display the messages on the OLED to prove we get them transferred successfully. We are trying different methods of moving the cursor around the screen. I figured out earlier that if you wanted to move the cursor one place you would add 4. Cullen just figured out that if you got it to the bottom row you only needed to add 1. Something is not right about this cursor movement. Adding these numbers randomly is flipping bits that aren't supposed to be flipped because the oled sometimes glitches and displays japanese characters.

I brought my lab kit from ECE 362 so that I could build another prototype and work alongside Cullen on a second device. Got the prototype built on the breadboard now. Just copied the code over to a CubeIDE project but when I go to flash it using the cable from 362 it tells me I need to update it. Just googled the problem and found out that the 362 class gets cheap clones of ST-Links and they don’t work with the CubeIDE. I would like to have a nice conversation with whoever made that decision. I got out the real ST-Link that Visuwanaath was trying to use a few weeks back, and am hooking up all the same cords between my device and the micro. No luck. I am going to check out another STM32L476 dev board that the others are using and just build another prototype.

example1
Real ST-Link

I built a second prototype and am now working with the code I had this morning. I really don’t have much to report now, its just minor code changes that work, then don’t work, then work perfectly, then I unplug the micro and it breaks when you plug it back in. I’m tired. This micro sometimes works when you push code, but if you unplug it and plug it back in and push the EXACT same code it breaks. I don’t understand. Ok I finally figured out how to move the cursor. I dont understand how it works but sending 0x06 to the SPI1->SR register instead of adding 0x04 to it like I was previously doing moves it consistently. I just tried random bits from the datasheet until I got it working.

example1
SPI1602A OLED cursor movement datasheet

Now I can get the micro to display an entire line of text as long as they are all characters.

example1
OLED displaying string on two lines

I am now converting the code snippet and turning it into a function where you can input the code to the function as a character string and it prints it all out, no matter how long the string is. Converting a 8-bit character string into a 16-bit int proved to be a challenge but it works now. I am now able to display a message over multiple screens.


Here is the final code. I don’t understand why we need to keep sending 0x06 to the SPI1->SR register, it is done in the initialization so we shouldn’t need to do it again. If I comment it out, it works, but unplugging and replugging breaks the code if you push it again. I am so so confused why that is but I really don’t care anymore. It works. Here is the function.

	char myString[] = "This OLED can now display an infinite amount of characters!";
	OLED_SendString(myString);

	void OLED_SendString(char *myString) {
	
		// Initialization commands
		uint8_t init_cmds[] = {0x38, 0x08, 0x01, 0x06, 0x02, 0x0C};
		for (uint8_t i = 0; i < sizeof(init_cmds); i++) { 
			HAL_SPI_Transmit(&hspi1, &init_cmds[i], 1, 100); 
		} 
			
		// Convert 8-bit characters to 16-bit and add 0x200 to print to OLED 
		uint16_t size=strlen(myString); 
		uint16_t charList[size]; 
		for (uint16_t i=0; i < size; i++) { 
			charList[i]=(uint16_t)myString[i] + 0x200; 
		} 
		
		// Print string in chunks of 32 characters 
		uint16_t start=0; 
		while (start < size) { 
			// Clear the display 
			SPI1->DR = 0x01;
			HAL_Delay(10);
		
			// Move cursor to the first line
			SPI1->DR = 0x80;
			HAL_Delay(10);
		
			// Move the cursor forward after each character
			// ** Hunter thinks this isn't necessary but removing it breaks everything
			// ** DO NOT REMOVE IT WILL BREAK AFTER MICRO IS UNPLUGGED
			SPI1->DR = 0x06;
			HAL_Delay(10);
	
			// Print the first 16 characters of current chunk
			for (uint16_t i = start; i < start + 16 && i < size; i++) { 
				SPI1->DR = charList[i];
				HAL_Delay(10);
			}
	
			// Move cursor to the second line
			SPI1->DR = 0xC0;
			HAL_Delay(10);
	
			// Print the next 16 characters of the current chunk
			for (uint16_t i = start + 16; i < start + 32 && i < size; i++) { 
				SPI1->DR = charList[i];
				HAL_Delay(10);
			}

			HAL_Delay(500);
			start += 32;
		}
	
		HAL_Delay(2000);
	}
	
If any of my teammates wish to edit it, I can guarantee they will waste hours. Now we need to get our LoRa pcakets working so that we can make sure they get sent correctly.

Entry 3: -----------------------------------------------------------------

Date: March 11th
Start Time: 3:00pm
Duration: 1.25 hours

Cullen and I are in the lab now. I explained what the issues were with what we were doing and we are going to keep trying to get it to display a message. We keep running into the issue where the display only displays the first character.

example1
Only first letter of message being displayed

We are trying to manually move the cursor with some success. We can now display text on the first line but it doesn’t wrap around to the second line it just goes into the void I guess. We screwed something up now and it went back to displaying just the first letter again. We are looking at the 362 lab 6 starter code and they don’t manually move the cursor so I don’t know how what they do works but ours doesn’t. We are still in limbo as far as getting a coherent message displayed but here is the code we are working with so far.

	/* Initialize all configured peripherals */
	MX_GPIO_Init();
	MX_SPI1_Init();

	/* USER CODE BEGIN 2 */
	// INITALIZATION COMMANDS
	uint8_t init_cmds[] = {0x38, 0x08, 0x01, 0x06, 0x02, 0x0C};
	for (uint8_t i = 0; i < sizeof(init_cmds); i++) { 
		HAL_SPI_Transmit(&hspi1, &init_cmds[i], 1, 100); 
		HAL_Delay(100); 
	} 
	/* USER CODE END 2 */ 

	/* Infinite loop */ 
	/* USER CODE BEGIN WHILE */ 
	SPI1->DR = 0x01; // CLEAR DISPLAY

	while (1){
	/* USER CODE END WHILE */

		// DATA COMMANDS
		uint16_t display[34] = {
		0x002, // Command to set the cursor at the first position line 1
		0x200+'E', 0x200+'C', 0x200+'E', 0x200+'3', 0x200+'6', 0x200+'2', 0x200+' ', 0x200+'i',
		0x200+'s', 0x200+' ', 0x200+'t', 0x200+'h', 0x200+'e', 0x200+' ', 0x200+' ', 0x200+' ',
		0x0c0, // Command to set the cursor at the first position line 2
		0x200+'c', 0x200+'l', 0x200+'a', 0x200+'s', 0x200+'s', 0x200+' ', 0x200+'f', 0x200+'o',
		0x200+'r', 0x200+' ', 0x200+'y', 0x200+'o', 0x200+'u', 0x200+'!', 0x200+' ', 0x200+' ',
		};
	
		uint16_t charList[] = {'M', 'e', 's', 's', 'a', 'g', 'e', ' ', 'R', 'e', 'c', 'e', 'i', 'v'};
		uint16_t size = sizeof(charList) / sizeof(charList[0]);
		SPI1->DR = 0x01; // CLEAR DISPLAY
		HAL_Delay(50);
	
		uint16_t cursor = 0x02;
		for (uint16_t i = 0; i < 34; i++) { while(!(SPI1->SR & SPI_SR_TXE));
			SPI1->DR = cursor;
			// SPI1->DR = 0x200 + charList[i];
			SPI1->DR = display[i];
			HAL_Delay(50);
	
			// FOR THE TWO LINE-SET COMMANDS
			if((i != 0) || (i != 17)){
			cursor += 4;
			}
		}

		HAL_Delay(100);
		/* USER CODE BEGIN 3 */
	}
	
Next step is to obviously get this code working and I plan to make this into a function where we can just enter a message as a parameter and have it displayed on the OLED.

Entry 2: -----------------------------------------------------------------

Date: March 11th
Start Time: 10:45am
Duration: 2.25 hours

I met with Niraj for this morning because if anyone knows how to get this OLED working, it’s him. I brought the prototype into his office and we reviewed the code I did have. He recommended that I use baremetal commands to make it easier to debug so I am implementing that now.

example1
Niraj comparing my code with ECE 362 code

We still can’t get it to turn on so we are going down to the lab to see what signals are being sent to the OLED via the oscilloscope. The STM32CubeIDE LOVES to reset parameters I have set so it reset the number of bits per packet to 4 instead of 10. That was an issue for a minute but it still wont turn on even with the change.

example1
Looking at OLED initialization packets on oscilloscope

I showed Niraj what pins I had set on the micro and he noticed that I was using a GPIO pin for Chip Select (NSS) which he told me to set to NSS mode. I was under the impression that Chip Select would remain high for the entire time but he explaied that it should only go high for a short period BEFORE the message was sent, then go low again. I think that the reason the OLED wasnt turning on before was because we held the chip select high the entire time, basically telling the OLED that we were about to send a message, but never actually sending one. With that change, the OLED turned on.

example1
OLED turning on and displaying just A

I am going to play around with it to see if I can get it to display a sentence. I can get it to display a single character of my choosing now but nothing more that that. I will need to come back later and try to get it to display an entire line of text. We plan to use the oled to display messages that we are sending and receiving.

Entry 1: -----------------------------------------------------------------

Date: March 10th
Start Time: 3:30pm
Duration: 3.00 hours

I am in lab now trying to get this stupid OLED working. Niraj told us in our design review that the ECE362 OLED used 10 bit communication, not 8 like we were trying. I am playing around with the code now to see if I can get anything working. I am looking through the 362 manual and I can’t find anything wrong with what we are doing, even with 10 bit SPI. All the initialization commands are the same. Sophie is now in the lab and is making some finishing touches to the PCB now. Our first order came in, so we are opening our project box to make sure our sizing is correct for the PCB. She printed out a 1-1 print of the PCB. It appears to be a little too small.

example1
Printed PCB in project box

We just compared the size of the print and the size of the PCB design on Kicad and the print is definitely a few mm off. We just looked at the actual size and it seems like the PCB she was designing was a few mm off the exact measurements on our project box websites. She just fixed that along with the mounting holes shifting slightly. She printed it out again and it looks to be close to the exact size. Since the printer is still a few mm off we will just assume that everything is exactly where it needs to be because it sure looks that way. I scheduled a meeting with Niraj for tomorrow morning so the next step is to meet with him to get this OLED to turn on.

=============== Week 8: =================


Entry 4: -----------------------------------------------------------------

Date: March 5th
Start Time: 2:45pm
Duration: 1:25 hours

The team met in the lab for an hour before the presentation to practice and flesh out any bumps in the presentation. I just reviewed what I wanted to say for the schematic slides, mainly focused on exactly what language to use with the buck converter. I also explained the software flowchart to Visuwanaath so that I could practice and he could get a better understanding of the software functions that I was envisioning. Sophie just gave me the rundown of all the minor changes she made to the PCB since earlier this week and everything that still needed to happen. Next step is to deliver an absolutely flawless presentation in front of our peers and definitely get a 100% on our perfect design review.

Entry 3: -----------------------------------------------------------------

Date: March 4th
Start Time: 5:45pm
Duration: 2.00 hours

Cullen, Visuwanaath, and I are in the lab now trying to finish up most of the presentation. Cullen wants to to update the block diagram so I will do that now.

example1
Updated Block Diagram for presentation

I am reformatting a lot of the slides and recoloring some text. I am helping Cullen format his major components slides to fix the spacing. Cullen saw Sophie earlier and she said she was still working on the PCB so I’m just a wee bit worried about that. I will have to talk with her before our presentation to make sure I understand any changes she has made since yesterday. I just got a message from the procurement office that they duplicated our order. I sent them an updated list, since they indicated they hadn’t ordered anything yet, and they reordered everything. They really need to read their emails. I even replied to the original email saying that this was an update and we did not want two of everything. Now we have to send back some digikey parts. I don’t know what the old system was but this has not been a pleasant ordering system. They do not communicate in a timely manner.

Entry 2: -----------------------------------------------------------------

Date: March 4th
Start Time: 1:45pm
Duration: 2.75 hours

I just received confirmation that the procurement office ordered our matrix keypad. It is quite concerning that they haven’t ordered anything else. I fear this new process is actually a downgrade rather than just buying stuff ourselves. Not happy with them at the moment. I ordered 5 LoRa modules with our personal funds for $85.60. The shipping cost was $30 no matter how many we ordered so Sophie and I agreed yesterday to just order 5 and pray we don't need more than that.

example1
Order for 5 LoRa modules

I am now working on the presentation. About an hour in now and I don’t have a ton to write about, I just pasted pictures of the schematic on the slides and wrote out notes on what to say for each slide. Another hour and a half now and and about halfway through the software status flowchart and again am writing out what I want to explain for each slide. I just finished and I plan to meet with the team tonight to practice. We still need to do a good chunk of the presentation.

Entry 1: -----------------------------------------------------------------

Date: March 3rd
Start Time: 3:45pm
Duration: 4:25 hours

Cullen and I are in the lab and will start grinding out our midterm design presentation. He just assigned me the software development status slides and I will probably just take the current software flowchart I made for the software formalization report and recolor it to show what is done and what is being worked on. I just recolored it into green for done, yellow for working on it, and red for not started yet. Most of the flowchart is for the menu which we haven’t started so unfortunately most of it is red. Darn. Sophie just got here so I am pivoting to help her with the PCB. She finished the schematic over the weekend and made good progress on the PCB design. I am now helping her edit the pcb layout to include the screw holes and match the shape of the box better.

example1
PCB size constraints for box

She was not super happy that the screw holes messed up our GPS ground plane, which was supposed to be 50mm x 50mm, as specified in the datasheet, but now has to be 45mm x 45mm. Either way the size now matches and we can go about adding everything else onto the board. She will probably be making edits up until our presentation tomorrow so Cullen just told her to worry about the PCB slides of the presentation and left the schematic explanation slides to me.

example1
An unhappy Sophie editing the PCB

Cullen and I continued to make formatting changes to the design review presentation. He updated the website and added a fun little addition to our team home page. I need to remember to update our website completely before the presentation Wednesday afternoon. We have changed many parts since it was last updated. Tomorrow I will need to complete my sections and begin practicing the presentation with the team.

=============== Week 7: =================


Entry 4: -----------------------------------------------------------------

Date: February 28th
Start Time: 2:45pm
Duration: 2.75 hours

I am in the lab alone today, and I will continue trying to get the OLED to turn on. I found the datasheet for the OLED that Cullen had pulled up two days ago and checked that all the wires were correct. I booted up my STM32CubeIDE and now set pins on the MCU in the software. Cullen sent me the code we were using yesterday, so I had a good starting point, but I also watched the first few minutes of this Youtube video to refresh my memory on how to set up pins in the IDE. I tried messing around with different packet types and setting GPIO pins high/low to see if I could even get the screen to turn on. I spent about 2 hours of googling different ways to set up spi on an OLED this was the code I have now. The only real surprise was that for half of the time, I was sending bits in 4-bit mode when it should have been in 8-bit mode.

	int main(void){
		/* USER CODE BEGIN 1 */
		/* USER CODE END 1 */
		/* MCU Configuration--------------------------------------------------------*/
		/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
		HAL_Init();
		/* USER CODE BEGIN Init */
		/* USER CODE END Init */
		/* Configure the system clock */
		SystemClock_Config();
		/* USER CODE BEGIN SysInit */
		/* USER CODE END SysInit */
		/* Initialize all configured peripherals */
		MX_GPIO_Init();
		MX_SPI1_Init();
		/* USER CODE BEGIN 2 */
		HAL_GPIO_WritePin(GPIOE, GPIO_PIN_10, GPIO_PIN_RESET); // RES LOW
		HAL_Delay(50);
		HAL_GPIO_WritePin(GPIOE, GPIO_PIN_10, GPIO_PIN_SET); // RES HIGH
		HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12, GPIO_PIN_RESET); // CS LOW
		uint8_t init_cmds[] = {0x38, 0x08, 0x01, 0x06, 0x02, 0x0C};
		for (uint8_t i = 0; i < sizeof(init_cmds); i++) { 
			HAL_SPI_Transmit(&hspi1, &init_cmds[i], 1, 1000); 
		} 
		/* USER CODE END 2*/ 
		/* Infinite loop */ 
		/* USER CODE BEGIN WHILE */ 
		while (1) { 
			/* USER CODE END WHILE */ 
			uint8_t character='A' ;
			HAL_SPI_Transmit(&hspi1, &character, 1, 1000); 
			HAL_Delay(1000); // Delay for readability 
			/* USER CODE BEGIN 3 */ 
		}
		/* USER CODE END 3 */ 
	}
	
I have to go to the Purdue basketball game now but over the weekend we might have to work a bit harder to get this working. I think we should try it in parallel or even with an arduino just to make sure the screen even works.

Entry 3: -----------------------------------------------------------------

Date: February 26th
Start Time: 3:00pm
Duration: 3.25 hours

For ManLab today we will try to finish the schematic and correct our already-made PCB design. Sophie was looking at our keypad on amazon, as it didn’t have a datasheet. She noticed that it required 12V, which we could not do. That is totally my bad for not checking. I had just assumed that a directional keypad made for an Arduino WOULDN’T REQUIRE 12 VOLTS. Anyway that sucked and so now we will go with our original plan for designing our directional keypad with regular pushbuttons. I’m moving over to help Cullen with getting our OLED1602-SPI display working on our prototype now that Sophie is in a good place to finish the schematic. He has been unsuccessful so far and we are trying to send several packets to the OLED over SPI to wake it up. It doesn’t help that the OLED we used in 362 has an awful datasheet. We have been trying different packet types and byte combinations for the past hour and nothing seems to work. The current method of sending packets we are trying is this:

	uint8_t TX_Buffer_init[6][8] = {{0, 0, 1, 1, 1, 0, 0, 0},
	{0, 0, 0, 0, 1, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 1},
	{0, 0, 0, 0, 0, 1, 1, 0},
	{0, 0, 0, 0, 0, 0, 1, 0},
	{0, 0, 0, 0, 1, 1, 1, 1}};
	
	for(uint8_t i = 0; i < 6; i++){ 
		HAL_SPI_Transmit_IT(&hspi1, &(TX_Buffer_init[i]), 8);
		HAL_Delay(1000); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12, GPIO_PIN_RESET); // CS LOW 
		HAL_SPI_Transmit(&hspi1, &TX_Buffer_init[i], 1, HAL_MAX_DELAY); 
		HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12, GPIO_PIN_SET); // CS HIGH
		HAL_Delay(1000); 
	}
	
example1
Cullen and I working on OLED prototype

Professor Walters and the TAs came over to do their check in. They mainly talked to Sophie about the progress on the schematic and PCB so Cullen and I just kept working. We did not succeed in getting the OLED working. Before everyone leaves, I will verify our parts order with the team and send it off. Next, we need to get this stupid screen to turn on and start on our presentation next week.

Entry 2: -----------------------------------------------------------------

Date: February 25th
Start Time: 5:45pm
Duration: 2:00 hours

Sophie and I are in the lab and are going to go over the feedback I had. I installed STM32CubeIDE to prototype with Cullen and Visuwanaath. Sophie had a more updated model than I had so some changes were already fixed. We changed the buck converter schematic to look more like a lecture with the decoupling capacitors in a different configuration. We looked at my LoRa feedback and wired up all the pinouts that she hadn’t connected yet. We also added decoupling capacitors and made sure to wire up all voltage inputs (including Vbat) correctly. Sophie hadn’t wired up the GPS chip yet so we pulled up the datasheet and wired it.

example1
Sophie updating the schamatic

We just finished looking at my feedback and will spend the rest of the time connecting everything to our MCU. We will still have to add our user interface items like the OLED, directional keys, and keypad.

Entry 1: -----------------------------------------------------------------

Date: February 24th
Start Time: 3:45pm
Duration: 1.25 hours

I am looking over the Kicad schematic Sophie sent me last week. It’s not the most updated, but I will look for any major errors. Here are my notes after looking at all the chip schematics Sophie created:

  • LoRa Module
    • Vbat should be connected to 3.3 V (or be left empty but that's not good practice)
    • PH3 pin needs 10k resistor so write that in the schematic instead of just "R"
    • For my own understanding, could you wire the LED to the pins directly? Why the transistor?
  • Compass Module
    • Why do we not use SPI Serial Data Out (pin 5)?
    • Put pin 11 to GND
    • Do you want to use the reset pin?
  • OLED
    • I'm assuming you want to do 4-wire SPI set BS0 and BS1 to GND?
  • Dpad/Keypad
    • Update with new parts, new dpad has 6 pins (pinouts in parts doc) and keypad has 7

I asked her to send a current version of the PCB for me to check, as I know she has made changes to it that need to be reviewed.

=============== Week 6: =================


Entry 7: -----------------------------------------------------------------

Date: February 21st
Start Time: 7:30pm
Duration: 0.75 hours

I am updating my journal on the website as well as our updated project description and PSDRs. I will also update the documents and references. We should start putting some cooler pictures on the website its kinda plain.

Entry 6: -----------------------------------------------------------------

Date: February 21st
Start Time: 2:45pm
Duration: 1.25 hours

The team decided to meet at Harry's today. Cullen and I arrived early to secure a table and he walked me through his STM32CubeIDE progress and walked me through how to start a new project and how to prioritize interrupts. The rest of the team just showed up and now we’re talking about the progress this week and what progress we need for next week. We're about an hour in and we're getting “sidetracked” so not much is happening the rest of the meeting.

example1
Cullen showing me how to navigate STM32CubeIDE
example1
Cullen and Visuwanaath showing their dedication to the project while in a bar

Entry 5: -----------------------------------------------------------------

Date: February 20th
Start Time: 3:00pm
Duration: 1.50 hours

Cullen and I are in the lab just before class and I am wrapping up the repairing two sections of the software formalization report. I made some minor changes to the flowchart regarding the mesh network and noted what types of packets it would need to forward. I ran through the entire flowchart with Cullen to make sure I hit everything and he thinks it's good as it stands. I want to run it by Visuwanaath though, as he is the unlucky software lead who will need to write most of these functions.

Entry 4: -----------------------------------------------------------------

Date: February 19th
Start Time: 7:15pm
Duration: 4.00 hours

I am working on the software formalization flowchart diagram in draw.io right now and I think I will work on it for a few hours and just try to knock it out tonight.

example1
Interrupt functions for receiving a packet
example1
Functions for beacon messaging and searching
example1
Functions for messaging and waypoints
example1
Functions for initialization procedure
example1
Legend for the diagram

Making this diagram took a little over 3 hours and it would be much easier for anyone reading this to just look at the flowchart yourself linked here rather than reading an entire explanation so I will spare the paragraph. Now that that is done I want to make sure to color-code the boxes as to what module they would interact with. That took about 30 minutes. Blue and maroon boxes are LoRa functions, green boxes are GPS functions, and pink are compass functions. White arrows are options paths the user can choose via the GUI, green arrows are for functions that are instantly called after the previous is finished, and red arrows are for when the function chain is done and the menu needs to return to a previous page. Holy moly those picture are blurry I highly recommend looking at the flowchart on draw.io to see every box clearly. I'm a bit tired right now so I'll have to check my work here next when I'm more awake.

Entry 3: -----------------------------------------------------------------

Date: February 19th
Start Time: 2:45pm
Duration: 3.75 hours

I am in the lab a bit early for ManLab so I will read over Visuwanaath’s software overview to give myself a good start with my software formalization report this week. I updated our functionality flowchart from a few weeks ago with more clarifying details. Professor Walters came over to us right at the start of the lab and we talked about updating our PSDRs to match some of the changes suggested by Shivam to Sophie last Friday, he liked all of our changes so our final PSDRs and Functional Description are:

example1
example1
Updated functional description and PSDRs

We also talked to him about the PCB size issue and he told us plainly that what we were building was a prototype and that while it shouldn't look terrible, it should be larger so that we have space to work and make sure everything works. He said that shrinking the design is something that teams do later. Just after he left the team agreed to use the larger box. I did a quick search to find a better option for our directional keys rather than designing physical buttons. Sophie and I were talking about how much of a pain a physical keypad and directional keys would be when I stumbled upon a membrane flat directional keypad. I’m showing the team and getting good feedback so I think we will go with it. We now have a flat membrane keypad and flat membrane directional keys which means the front of our design will be super easy to waterproof.

example1
Amazon picture of membrane d-pad

I am starting the software formalization and am researching the license for the STM32CubeIDE. Not finding a whole lot about the type of license but I found their user agreement. I talked with Visuwanaath about what libraries he was using and if they were more than just the standard libraries. He said we wouldn't need anything special except for the GUI. I am now working on the packet types chart and just found the “time to live” method of mesh communication. TTL allows each packet to have a maximum number of times it can be sent to other devices before it stops being forwarded. Put simply, it stops infinite loops.

example1
Packet types for LoRa to send/receive

I looked for libraries we could use to create or user interface and found LVGL and Embedded Wizard as options. Embedded Wizard wants us to set up a payment plan so that's a no-go. LVGL advertises itself as working well with small microelectronic screens so I will look into it more. LVGL is written in C, has an entire open source repository, and looks to have just about everything we’d need for a display so I will pick that as our first choice and add it to the report. I also found a Youtube video that talks about how to get started with LVGL on STM32 and it will be something to watch next week. Soon, probably next week when I have more time I will start learning how to get a GUI working on an OLED display.

Entry 2: -----------------------------------------------------------------

Date: February 18th
Start Time: 5:30pm
Duration: 2.25 hours

The team just got out of class and we’re in the lab now to start prototyping. Sophie and I told the team about the PCB size problem and I began looking at the larger version of our box, the H759VBK. This box has much more room for a PCB and our screen, which we had noticed was a big big for the old box. Moving to this box has us talking about the renewed possibility of keeping our flat membrane matrix keypad on the front. I drew out the expected component and box sizes (PCB size included) to show the team the size of all of our box, screen, keypad, directional keys and more. Sophie brought up that all sizes of our box could support a top and bottom PCB so we discussed the possibility of having half our components at the top and half on the bottom. We are still unsure about the idea and will talk more in lab tomorrow. We need to figure out this box situation ASAP because our PCB and the rest of the outer components depend on box dimensions.

example1
Paper drawings of box and screen sizes

I spent 10 minutes helping Cullen set up his prototype board that he will start testing our components with.

Entry 1: -----------------------------------------------------------------

Date: February 18th
Start Time: 3:30pm
Duration: 1.00 hours

Sophie and I are meeting in the lab before class to look over her Kicad work. She walked me through all of the footprints she created herself and where they were located on the board. She explained the concept of separating ground planes to me and why it would be necessary due to our two chips both using radio frequencies. She also showed me the header pins we would use for testing which I never thought about until now. I think the location of everything is good but I’m worried about size because she is squeezing everything together which will be uncomfortable on a prototype. The website where we will but our project box from has a blueprint of the pcb size that can get screwed into it. Sophie and I made the shape in Kicad and we discussed how it was waaaay too small for everything that we were trying to put onto the pcb. We need to leave for class now but we need to either pick a bigger box or figure out how in the world we can fit all this onto a tiny pcb.

example1
PCB blueprint for H659V

=============== Week 5: =================


Entry 4: -----------------------------------------------------------------

Date: February 12th
Start Time: 3:30pm
Duration: 3.75 hours

Sophie, Cullen, and I are in the lab today and started the day off by going through the 10 PSDRs I drafted and narrowing it down to our 6 favorites. We will wait for the professor to come around to us to see if they are good enough. We are also updating the functional description to contain all the information we want to have about the mesh protocol and the low power modes which we completely forgot to write about. We also added more information about what modes our device will have and what each one will do.

example1
Final draft of functional description

The professor came over and we walked him through each PSDR. He helped us narrow them down to 5 and talked about what updates we should make to each one. He didn’t look over the description so we’ll have to reach out later and see what he thinks. We then discussed the problem of interference between the GPS internal antenna and the LoRa external antenna. Since they have to be a few inches apart and our PCB is limited by our already small box, that will certainly be a problem in the future when designing the layout of our PCB. Cullen talked about using mouse buttons instead of regular push buttons because of their awesome feel and sound. I agree they are much cooler. I found the SKRPABE010 buttons on Digikey that we could use and added it to our parts list.
example1
Alps Alpine SKRPABE010 button

I continued work on the bill of materials due this week. Though I still don't know what the “package” column is for, all other columns are now filled out. The only thing still on my mind is if we need cables from the 9V battery connection to the PCB. I didn’t include it because I’m sure the cables will be super cheap if they aren’t already available in the ECE shop.

example1
Bill of Materials

Next week I will need to get on the schematic design because Sophie has made tons of progress and I need to catch up with what she has done.

Entry 3: -----------------------------------------------------------------

Date: February 11th
Start Time: 4:30pm
Duration: 1.75 hours

After class, Cullen, Sophie, and I all came down to the lab. I showed Cullen the project box and the OLED screen options I had found. Since he has been working on the mechanical overview all week, we decided we should pick our exterior parts ASAP so he could get the CAD models for everything. We started chatting about how other similar devices on the market have a full keyboard and talked about how much better our design would be with one. We went down a rabbit hole for about 30 minutes trying to find a keyboard small enough. We did find a few good options.
example1
Solder Party BB Q20
example1
CardKB Mini Keyboard

However, even these almost unusably small keyboards were still two wide for our box. I mentioned that if we were going for a weatherproof design, a small keyboard would be impossible to design a cover for and that even the 4x3 matrix keypad we were thinking of using had extruding buttons that would be a struggle to weatherproof. We discussed the idea of using a flat keyboard I had found, which would make it much easier to design a waterproof sheet.
example1
Adafruit Membrane 3x4 Matrix Keypad

We started talking about how we could print stickers with letters or numbers depending on what we wanted the keys to do, which would be super easy to then put on and cover without being too noticeable. We eventually decided that since the hope of finding a miniature qwerty keyboard were shattered, the flat membrane keyboard was an easy second choice. I found 2 small motors that we could use for a stretch PSDR. The team has been making small talk about adding a buzzer to the device to alert the user they have received a message when it is in their pocket. No pushback from Sophie or Cullen on the DC 3V 12000RPM Micro Flat Vibration Motor I picked so we effectively decided to add it to the parts list. When we get in the lab tomorrow we will need to narrow down our PSDRs because we probably should’ve had them more finalized by now.

Entry 2: -----------------------------------------------------------------

Date: February 11th
Start Time: 2:30pm
Duration: 2.00 hours

I started searching for OLED screens for the device. Most of them were really small, less than 2” diagonally and were priced $30+ each which sucks when we are talking about making 4 beacons. Anyway, I found one that was a good size, the NHD-2.7-12864WDW3-M, which has a 2.7” diagonal which fits nicely within the super awesome box I had just found. These screens are $43 each though so they might end up being the most costly part of the device. I rewrote and added new PSDR options so that we ended up with 10 options to choose from and get feedback on.

  1. (Software): An ability to request the location of other Buddy Beacons within 2 miles (depending on location and obstructions) and display a compass pointing toward the other device on an OLED screen.
  2. (Hardware): An ability to communicate between an STM32 microcontroller and LoRa chip over UART in order to receive GPS and message data from other Buddy Beacons.
  3. (Hardware): An ability to communicate between an STM32 microcontroller and GPS chip over UART in order to receive GPS coordinates.
  4. (Hardware): An ability to communicate between an STM32 microcontroller and 3-axis compass chip over I2C in order to receive magnetic field direction.
  5. (Hardware): An ability to read input from a 4x3 matrix keypad via 7 header pins and translate the number of presses of each key into a letter while messaging.
  6. (Hardware): An ability to use a buck converter to step down battery voltage from 9V to 3.3V in accordance with the power draw of the STM32 microcontroller, GPS chip, LoRa chip, 3-axis compass chip, and OLED display.
  7. (Hardware): An ability to enter a low power mode or sleep mode depending on a users button press pattern.
  8. (Software): An ability to send custom messages less than 300 characters entered by a 4x3 matrix keypad to other Buddy Beacons via LoRa.
  9. (Software): An ability to store and name GPS coordinates as waypoints and locate them from a menu via directional buttons on the device.
  10. (Software): An ability for multiple Buddy Beacons to act as a mesh network when device A is within range of device B, device B is within range of device C, but device A is NOT within range of device C.

I also added the following paragraph to the functional description to better describe the 3 modes we plan to have on the device.
example1
Added paragraph

After today, we have a pretty good list of parts to choose from when it comes to deciding which exact parts we want to use. Next steps will be to actually pick parts and begin designing our PCB depending on the size of the box.

Entry 1: -----------------------------------------------------------------

Date: February 10th
Start Time: 4:45pm
Duration: 1.50 hours

I started the bill of materials and put our STM32, LoRa chip, GPS chip, and compass chip information onto the spreadsheet. The rest of the parts, aside from the PCB, will be completely up to the size of the box. I then looked at housing cases for our 9V battery and found two options, both almost identical, that were just black boxes with two wires coming out. I started the search for a case for our Buddy Beacons. While most options were just a rectangular box of varying sizes, while scrolling on Digikey I found the perfect plastic box for our device. The first one I found, the H759VBK, was a bit larger than my team was going for but I quickly found its little brother, the H659VBK. This box measured 4.940" L x 2.750" W x 0.940" H which was near perfect for being a handheld device and the best part is that it had an included spot to put a 9V battery!

example1
H659VBK project box

After finding the case, I talked with Sophie, who was also in the lab with me, about her progress on getting the STM32L476 Discovery Kit micro working. She was having a bit of trouble with the code but should be fine. Sometime this week I need to refresh my memory on how to program a micro because what she showed me was all a blur.

=============== Week 4: =================


Entry 3: -----------------------------------------------------------------

Date: February 7th
Start Time: 2:45pm
Duration: 2.25 hours

Cullen and I selected the compass module we wanted to use which was the SAM-M8Q-0. This was one of the only ones on our list of options that wasn’t obsolete. We also already had a dev board for it and knew the chip worked well. We then selected the compass module we wanted to use, the MMC5983MA. All 3-axis chips we looked at do the exact same thing so their isn’t a problem with any of them per se, but some were obsolete. Lastly, we looked at antennas that could work on our beacon, making sure they were ~3 inches or shorter. We wanted them to be able to either fold or be small enough where a person could comfortably put them in their pocket. We landed on the ANT-LTE-MON-SMA-L and X000005. The first folds and the other doesn’t. We don't have to pick one just yet, and the LoRa breakout board Cullen ordered comes with antennas that we can use to test anyway. Once we had picked the parts, we both tried to find a breakout board for the STM32L4R5VIT6 micro that we will use to no avail. We did find a similar dev board that we could use however. Before we ordered anything I checked the cabinet with Shivam and grabbed two STM32L476 Discovery Kits. These have two microcontrollers that aren’t as good as ours but should do the job to test functionality. I also grabbed a “Adafruit Ultimate GPS Breakout” GPS module that we could use to save money on a second GPS dev board. I put in the request forms for everything I checked out. I put in the request to order two of the compass modules at $21 a pop. We will need to get the case design fleshed out next week and then once we have all components we can start prototyping everything. I put all of my journal entries on the website.
example1
MMC5983MA 3-axis compass breakout board
example1
SAM-M8Q-0 GPS breakout board

Entry 2: -----------------------------------------------------------------

Date: February 5th
Start Time: 3:30pm
Duration: 3.50 hours

Cullen, Visuwanaath, and I began looking up our options for compass modules. We quickly ruled out IMUs as they had many extra features that we didn't need. They also draw more power and cost more. We settled on a list of 4 potential 3-axis compass chips that should do the job. We also looked into GPS modules which was more tricky. We quickly realized that some GPS chips needed external antennas. I looked up what type of antennas were best and most common for GPS chips and landed on panel antennas. We joked about how horrible a panel antenna would look on the device we had envisioned, especially since it would have to go on the front side facing the user. Not to mention waterproofing the antenna would be impossible. We left it up in the air for the time being. We decided to use the RYLR993 as our LoRa module due to its frequency band and more useful pinouts.
example1
RYLR993 LoRa Chip
example1
Example panel antenna

The professor came over toward the end of the lab section and walked us through how our functional description and PSDRs were coming along. Cullen had updated the description to be more descriptive last week so only minor concerns were discussed. The PSDRs needed some work, especially the one about sending messages. We didn’t specify what would be sent or how. We have talked about sending 300-character messages, but we haven’t written it down in the PSDRs yet or our description. Whoops. I think once this week is done and we pick out all of our parts we should be able to finalize the PSDRs.

After class, we continued to talk with Shivam and the professor to discuss some of our concerns given our part considerations. Sophie talked about her progress in designing a buck converter for our 9V battery and how that would be a significant challenge in the coming weeks. I was still torn on whether to use a GPS chip with an internal or external antenna. As I brought this up, the professor noted that we might also get some interference from the LoRa chip if they are too close together. That didn’t make me feel too good. We will probably have to put them on opposite ends of the device. My group decided to use an internal antenna for now and hope that it works when we test it, otherwise we will need a whole new and quite unwieldy antenna slapped onto our device.

We decided to use the STM32L4R5VIT6 Microcontroller. It fits all of our needs, and it’s part of a low-power line of STM32s. Once we were ready to head out, we talked a little about what we needed to have done by the end of this week and the next. We agreed that we should have all parts picked out by the end of this week and that many of the casing decisions should be made by early next week.

example1
STM32L4R5VIT6 Microcontroller Chip


On my way out I learned that you’re not supposed to touch the bottom of a PCB when testing as it could cause a short through your fingers, so I’ll have to be careful when picking one up in the future!

Entry 1: -----------------------------------------------------------------

Date: February 3rd
Start Time: 4:45pm
Duration: 3.00 hours

Sophie and I talked about what functionality the LoRa module needed to be able to do for a while before I began researching LoRa chips on Digikey. I didn’t find nearly as many options as I was hoping but I found a solid list of 5 options for us to look at and put their links and datasheets in a shared team document. While I’m not sure about how each specific chip is different other than the slight frequency ranges, most chips have the same functionality, compatibility, and ability to attach an external antenna. I then got to looking into antennas. Sophie and I spoke briefly about what design we were looking for, mainly that we wanted a walkie-talkie look to the finished product, and then googled what each type of antenna was good for. We landed on a few options of whip antennas that could fold up when the device user wanted to fit the device in a pocket. We will still need to look into what frequencies we can use in the US and if these LoRa modules are legal. We don’t exactly want the FCC coming after us while we’re trying to send messages across the room. I also helped Sophie out with her website and learned how to use HTML and CSS. She was having some trouble with images and I was able to help her fix her issue with spacing.
example1
ANT-LTE-MON-SMA-L Antenna we liked

=============== Week 3: =================


Entry 6: -----------------------------------------------------------------

Date: January 29th
Start Time: 11:00pm
Duration: 1.00 hours

I spent some time updating my journal on the website and updating other parts of the website with updated info such as the home page and the team info. No progress except for bookkeeping.


Entry 5: -----------------------------------------------------------------

Date: January 29th
Start Time: 3:30pm
Duration: 3.00 hours

The whole team met for the lab today. Cullen and I spent some time creating a flow chart of what each divide had to do in each of the scenarios it faced. Visuwanaath was working on his Software Overview which made this process easy, as he had already thought of some codes for the signals and what each response had to be. Still, it gave Cullen and me some peace of mind knowing that all cases were covered. We then created a sketch of what the shell of our device would look like, as we had a few disagreements as to where the buttons would be. We talked about adding a D-pad to navigate the menu, which led us to find out that D-pads have to be added to the PCB itself. That sounds hard, we aren't about to go down that road. We looked for some directional buttons online and found a few options. Most are 5 push buttons arranged in up/down/left/right/enter fashion. Many are expensive so we wouldn’t want to order one online. We talked about 3D printing them, but none of us have experience so that conversation is for another day. Nothing is finalized with the physical design. That we will try to lock down next week.
example1
Functionality flowchart

example1
Design draft

Entry 4: -----------------------------------------------------------------

Date: January 28th
Start Time: 11:00pm
Duration: 1.75 hours

I finished the PCB design video. I encountered a few trace issues that the person in the video didn’t. Even with the free routing extension he suggested, there were still issues with the traces. There was some thermal issue [Future Note: Sophie said it was because my GND pin is already connected with the PCB and didn't need to be connected to anything like I had done] that I fixed by shuffling wires around and manually moving some traces around to allow more room. Visuwanaath sent a doc in our group chat that was the KiCad document his club uses. I skimmed it but after the video, I knew pretty much all of it. The custom part creation could come in handy later. I recommended the video to my Cullen and Sophie who indicated they wanted to learn PCB design. Nothing more to do with this until we get into week 6 and start designing our actual PCB.
example1
Finished PCB in KiCad 3D viewer

Entry 3: -----------------------------------------------------------------

Date: January 28th
Start Time: 5:30pm
Duration: 1.25 hours

Sophie, Visuanaath, and I discussed which MCU would be best after class. We found this filter on the STM website that lets us put our hardware requirements in to narrow down our choices. We came up with these parameters:
  • Series: L4/L4+/U5
  • Pin Count: 100+
  • Flash: 2048kB+
However, we decided that we needed to know more about our other modules before picking the exact one from the 150+ options provided by the filter. We are still shuffling ideas around with what exact modules we want to use and even how we want to power it all. We will have to talk more about what we need our device to do, what modules can achieve this functionality, and essentially know everything about our project THEN choose what micro could do it all.
example1
STM website filter

Entry 2: -----------------------------------------------------------------

Date: January 28th
Start Time: 2:00pm
Duration: 1.00 hours

I continued watching the video and now moved the schematic I designed in the first half onto a PCB board where I could arrange everything where I wanted it. The video walked me through how to add each layer to the board. Next, I will wire it all together and then download the files that could be sent to a manufacturer.
example1
Unfinished PCB with schematic design

Entry 1: -----------------------------------------------------------------

Date: January 28th
Start Time: 11:00am
Duration: 1.25 hours

I began watching the YouTube videos the professor provided for us on learning KiCad for our future PCB design. However, the videos were for KiCad 6.0 but the most recent version, which I downloaded, was KiCad 8.0. Many of the features had been relocated in the newer version, which made the outdated tutorials very hard to replicate. I eventually started watching this tutorial on KiCad 8.0, which went through each step of the process from idea to ordering the PCB. I replicated the design in the video and everything was easier to follow than the first time. I made it halfway through and I will try to finish this video soon so I can let my teammates know what resources to look at when they learn.
example1
Schematic replicated from video

=============== Week 2: =================


Entry 3: -----------------------------------------------------------------

Date: January 25th
Start Time: 12:30pm
Duration: 3.00 hours

I completed the sections that Cullen assigned to me on the Functional Specification report. I updated the functional description to include more about what conditions might prompt the user to buy our device and included more detail about the specific components we would use, now that we have begun narrowing them down. I then completed the theory of operation section where I discussed the Haversine equations that Visuwanaath found online. During this process, I tried to learn about how LoRa worked from this YouTube video, but since it is still proprietary technology, there isn’t much information out there. To be honest, most of what I learned went way over my head as far as LoRa is concerned. Finally, since I probably knew the least about microcontrollers among my teammates, I spent some time researching how they work and the pros and cons of each brand and line. I feel like I understand a bit more of the theory of our design, and knowing that the main formula we will need is a simple plug-and-chug, I feel like the math won’t hold us back. The next steps would be to figure out how our devices interact with each other and what exactly each has to do to meet our PSDRs.
example1
Haversine equations

Entry 3: -----------------------------------------------------------------

Date: January 24th
Start Time: 11:00am
Duration: 1.50 hours

I added all current journal entries onto the website and formatted them with pictures included in VSCode. I then took the lecture participation quiz. When this was done, I began formatting the functional block diagram in the functional description section of the functional specification report, adding the details of the updated modules we would use and clarifying wording. This will help us keep track of the different modules we need to think about when we eventually get to purchasing these parts.
example1
Functional block diagram

Entry 2: -----------------------------------------------------------------

Date: January 23rd
Start Time: 8:00am
Duration: 0.50 hours

I spent some time refining my journal entries to make sure they answered all 5 questions. I did this in the google doc that I track them in. Just clarifying thoughts that I jotted down while working. Other than record keeping, no real contribution to project progress.


Entry 1: -----------------------------------------------------------------

Date: January 22nd
Start Time: 1:30pm
Duration: 4.00 hours

I spent an hour putting the first journal entry into the website. I wanted to center the image and caption, which took much longer than I was expecting. Centering a div was easy, but getting both the image and its caption to fit on the page vertically AND be centered proved to be a challenge. Eventually, I figured out a way to do it in minimal lines of code. When my team members started to arrive around 2:30 pm, we began talking about what the benefits of each microcontroller brand were and which would be best for our project needs. We have not decided yet, but from our research online, STM has minimal power draw without wifi capabilities. We do not need WiFi for this project, so the exclusion of that could save us power and money. We debated between a rechargeable battery pack and alkaline batteries and had two people look up the pros and cons of each. Hikers are our main customers, so we debated which would be more useful to them. Carrying extra batteries would add weight to their gear, but for longer trips, bringing batteries would be much easier than having to find a power source to charge a Buddy Beacon. We decided to use a rechargeable pack moving forward. We figured that any people on a camping/hiking trip over 24 hours would likely bring portable power sources with them to charge other devices like their phones. Still, we decided that we wanted our device to function over 24 hours on a single charge and to add a sleep mode to save power. We talked about many of the constraints we would face and noted them all in the Functional Specification report. Late during our lab section, we met with the professor and two TAs to go over our preliminary PSDRs and Functional Description. We learned that we did not add enough detail to the description, which is my next step as assigned by my team leader. We also adjusted two PSDRs as suggested by the professor. This helped us think from the perspective of an outside consumer and the professor's comments introduced a new feature we hadn’t considered before, a way to be notified the device has received a message while in your pocket. The next steps for the team include finishing the Functional Specification report and continuing to discuss what parts we want in our device.
example1
Centered image and caption in HTML

=============== Week 1: =================


Entry 4: -----------------------------------------------------------------

Date: January 18th
Start Time: 9:00pm
Duration: 2.00 hours

I polished our Final Project Proposal before submitting it. I spent an hour researching and compiling a list for our preliminary budget. We are still undecided about many aspects of the project, such as what power source we will be using, whether we want a keypad or keyboard, and how large our Buddy Beacon will be, so I had to make some guesses. I suspect our budget will be ±$50 of what is on the document based on these factors. I also refined our PSDRs from 8 down to 5 and made sure they started with “An ability to…”. I also added my experience and what reports I wished to write. After I confirmed my team members had filled out their experience and noted which reports they would write, I submitted the report. This will help us later when we start narrowing down our parts list to keep us aware of our original budget, and from here on out we will need to keep in mind a single beacon could cost around $140 when deciding what parts to use.
example1
Preliminary budget

Entry 3: -----------------------------------------------------------------

Date: January 17th
Start Time: 11:00am
Duration: 1.00 hours

I spent another 30 minutes troubleshooting the team website. This time, I noticed our “Contact” tab names were updated. It appears that the header and navbar take longer to update online than other HTML files, which only take a few seconds. I spent some time updating other team information on the website and exploring what files were connected and how the website linked together. I then took the lecture participation quiz for the week. This made me more comfortable with putting info into the website and understanding the course requirements as I head into this large project. Next, I will need to start putting my journal entries into the website.
example1
Project description on website

Entry 2: -----------------------------------------------------------------

Date: January 16th
Start Time: 3:30pm
Duration: 0.50 hours

I spent around 30 minutes troubleshooting our team website after opening the “web” folder from our shared folder in VSCode. The navbar HTML file was updated but the changes were not appearing online. This was eventually resolved by another team member, though the navbar html file is still not displaying properly on the website. The “Contact” tab should show all four names of the team members in my group, but it still has us labeled as “MemberX”. This is troubling but will be resolved eventually and will not impact our progress. We will eventually need to get the HTML files working.
example1
Navbar issue

Entry 1: -----------------------------------------------------------------

Date: January 15th
Start Time: 3:30pm
Duration: 2.00 hours

I was introduced to the laboratory area by the professor where my team and I were led around to all storage cabinets and work areas. We were instructed on proper lab etiquette such as cleaning up the shared stations, not reusing cheap lab components, and not interfering with any other team’s equipment. I learned where the electrical component shelves, heating plates, and shared components from last semester were located. We got the shared website drive set up and discussed when each member was free during the week to work on the project. We also interviewed with the TA’s to inform them of our project goals. Learning where the shared components were located helped my team immediately, as we grabbed two LoRa modules. We will soon begin testing these modules to ensure we understand how they work and provided they work correctly, we will begin to add additional components to the breadboarded prototype.
example1
Lab station 8