I recently designed a PCB in Altium Designer that detects when a mailbox is opened. The purpose was to create a connivence to know when mail is being delivered so that people do not have to waste time going to check an empty mailbox. The schematic consists of the MPU-6050 gyroscope, Arduino Nano, and NRF Radio Module.
Essentially, the sensor is placed on the lid of the mailbox, so when the lid is opened, this produces an angular acceleration that is detected by the gyroscope, and when integrated with a complementary filter, one can detect the angular position of the lid. The radio module on transmitting circuit mounted on the mailbox then sends a signal to another NRF radio module which then turns on an LED or plays a sound on a speaker to notify that the mailbox has been opened. I only designed the transmitting PCB and will in the future work on the receiving circuit.
Above is the schematic I created for the PCB. The Arduino is on the top left, the gyroscope on the top right, and the bottom right is the NRF radio module. When I was researching how to use the NRF module, I noticed that there was a trace that said 50 ohms, which connected to the SMA connector. I realized it was for the antenna but didn’t know why it said to be for 50 ohms. After taking the Electromagnetics course, I realized that 50 ohms would match the transmission line with the antenna load because the circuit above was designed such that an impedance of 50 ohms would transmit the most amount of power and minimize reflections to the antenna, increasing its gain and making it more effective. I am still unclear about the inner workings of the radio module, but I know that it send a 2.4 GHz signal and the transmission line has to be of the right impedance to properly send that signal in free space to be picked by the other NRF radio module. That was my major revelation about RF and antenna engineering.
I spent a lot of time understanding what Altium does under the hood to determine the appropriate with of the microstrip trace to ensure a 50 ohm impedance, and I created my own impedance profile in this project. Altium essentially runs a formula that calculates the capacitance and inductance of the microstrip with the given layer stackup and distance from the ground plane. Altium runs a numerical model for calculating the impedance of the transmission line, which is exactly what we did in my Electromagnetics class. It is great to see how the concepts I learned that class is being applied to a simple IoT project.
My next steps for this project are to make this PCB smaller by using an STM 32 microcontroller and to work on the receiving PCB. I am sure that this will be much harder to implement because Arduino has a lot of development boards and drivers to make the electronics easy. However, creating the circuitry with just a microcontroller is more convoluted because it requires reading the documentation extensively and learning what protocols (I2C, SPI, and UART) other components use to communicate and send data to the microcontroller and how to setup the flash memory and protection circuits. Stay posted about future updates about this project and my growing revelations about electronics!