This project was completed as part of the Texas Instruments Summer Project 2020. This project was based around the TI-RSLK MAX robotics platform, which includes the MSP432P401R MCU LaunchPad™ development kit as an MCU and is compatible with the BoosterPack ecosystem. BoosterPacks are expansion boards that connect to the two twenty pin headers on the top of the LaunchPad to provide sensing, communication, and other additional features to the MCU. The goal of this project was to design and prototype a BoosterPack module for the TI-RSLK MAX to gain experience in circuit design, PCB design, and embedded firmware development, and to create a BoosterPack module that could be used to teach beginning engineering students key concepts.
Idea and Design GoalsMy idea was to create a BoosterPack that allowed for IR communication between multiple robots or MCUs. The BoosterPack would contain 4 IR receivers and 4 IR emitters to allow signals to be sent and received in every direction.
I chose to design an IR transmitter and receiver module because I felt that IR communication could be used to teach engineering students multiple important concepts, including PWM, signal modulation, and real-time systems programming. In addition, I felt that a BoosterPack for the purposes of IR communication between robots would be a unique addition to the selection of BoosterPacks already available.
What is IR Communication?IR stands for "infrared", and denotes the use of pulses of infrared light to enable digital communication between devices over short, line-of-sight distances. The infrared light emitted by the TSAL6200 emitters used in this project has a wavelength of 940nm, so it is invisible to the human eye. Much how humans often use light to communicate with each other (like turn signals on cars) or with machines (like traffic lights), one could envision a communication scheme where IR light is used to send messages to a TI-RSLK MAX.
Since we're dealing with pulses, one might think of another method of digital communication that has been around since the 1800s, Morse code. Morse code denotes different letters by different lengths of sound or light, called "dots" and "dashes". However, in our system, we only need to send two characters: 1 or 0. Using these two characters and the binary language of computing, theoretically any message could be sent. For our communication scheme, we'll call 0 a "dot", or a short pulse, and 1 a "dash", or a long pulse.
Unlike Morse code, our messages don't need to be decoded by humans, so the fact the IR light is invisible to the human eye is not a problem. This also means that we can send our messages much faster than a Morse code message would be sent, because the microprocessor on the TI-RSLK MAX (MSP432 from TI) can run at 48MHz, allowing it to process information much faster than a human can. We'll work on the order of microseconds, with our long pulses being 2000 microseconds long and our short pulses being 500 microseconds long.
There is, however, one problem with the communication scheme that we have envisioned, that being that over 50% of the sunlight that reaches the earth's surface is infrared light! It's as if we're trying to have a conversation in the front row at a rock concert, or more specifically, as if we're trying to send Morse code using a flashlight in broad daylight. In the same way that it would be nearly impossible for another human to distinguish when the flashlight is on or off because of the bright sunlight, it would be nearly impossible for the TI-RSLK MAX to decode a message sent with IR light when there is so much extra IR light in the environment.
To solve this problem, we need to add one more complication to our system. We will utilize modulation to distinguish our signal from the background noise of IR light present in the environment. This means that instead of just turning our IR emitter on for the time that we want to transmit something, we will instead switch it on and off very quickly at a frequency of 38kHz. This frequency is called the "carrier frequency", and our IR receiver will only detect signals at this frequency, pulling its output pin low whenever a signal at this frequency is being received.
With that final problem solved, we have developed our simple IR communication scheme. When we want to send a 1, we will pulse the IR emitters at 38kHz for 2000 microseconds, and when we want to send a 0 we will pulse the IR emitters at 38kHz for 500 microseconds. On the receiving end, a 1 will look like a 2000 microsecond long low pulse on the output pin of the receiver, and a 0 will look like a 500 microsecond long low pulse. We have just described a set of rules for communication between devices, also known as a protocol.
It is worth noting that there are many devices that use IR to communicate, including most TVs and other devices with a remote control. While these devices typically use more complicated protocols (this site describes some common protocols in detail), understanding the simple protocol described above provides one with the framework to learn more about other protocols if desired. With this knowledge, this project could be expanded to send the necessary IR codes to control TVs or other appliances.
Circuit DesignThe goal of the circuit design was to create a low-cost, easy to assemble, and capable circuit to send and receive IR signals. Components were chosen with these goals in mind, mostly with the goal of using entirely through-hole components to make the circuit easy to assemble without specialized tools.
The circuit is powered from the 3.3 V supply from the Launchpad, and includes a current-limiting resistor for each IR emitter. The IR emitters are driven through a logic-level MOSFET, because each emitter can pull up to 100 mA of current, which would surpass the 20 mA limit from a GPIO pin on the Launchpad. There is a current-limiting resistor on the gate of the MOSFET, along with a resistor to ensure that the gate capacitance of the MOSFET is discharged when it is in the off state. The IR receivers are connected directly to analog pins on the Launchpad.
PCB DesignThe PCB was designed with three major goals in mind: unobstructed transmission and reception of IR signals, easy assembly, and adhering to the BoosterPack format. To allow the unobstructed transmission and reception of signals, the receiver modules were placed in the middle of the board behind the emitters. This minimizes the extent to which the board receives signals emitted by itself, and allows the emitters an unobstructed path to transmit signals. Care was taken to provide adequate clearance for easy soldering, and a PCB template was used to ensure the correct dimensions to meet the BoosterPack standard.
The firmware was designed as a proof-of-concept of the device, and as it was my first experience with MSP432 programming, could be improved with more time. However, the firmware provides a demonstration of the hardware, and a basis to develop more complex programs utilizing the IR-RX/TX BoosterPack. The two provided programs demonstrate a simple communication protocol between two MSP432s, implementing the protocol described in the section above. One program sends the desired IR code, while the other receives and decodes it. These programs could easily be combined to create a system that could communicate in both directions. The receiving code utilizes interrupts, allowing for the MSP432 to run other tasks when no IR codes are being received.
ConclusionThrough this project I learned a lot about the engineering design process, and if I did this project again I would apply that knowledge and make some changes to the way I designed and executed the project. Most importantly, I would make sure to fully read and understand all datasheets of the components involved before deciding on pin assignments. During the circuit design phase, I decided to assign the output pins of the IR receivers to analog pins on the MSP432. However, after better understanding the datasheet of the IR receivers, I saw that this was unnecessary, as they output a digital pulse, not an analog signal. During the firmware development phase, I learned that the ideal way to measure the duration of such a pulse would be to use the capture function of the TimerA peripheral on the microcontroller. Had I been more familiar with the MSP432 during the circuit design phase, I would have decided to connect the outputs of the IR receivers to pins which are able to utilize the capture function of the TimerA peripheral. This would have simplified programming significantly.
Other than those design changes, I would make a few more improvements to the project given additional time. Firstly, I would conduct quantitative tests to determine if the hardware is functioning as intended. I would measure the effective transmission and reception distances, and determine power consumption of the device. Secondly, I would spend more time building out a more robust firmware base for the project, possibly developing a library for easier programming. Finally, I would explore other possibilities for the project, including using the hardware to communicate with consumer devices like TVs.
In conclusion, this was a successful project and I learned a lot from it.
I'd like to especially thank Texas Instruments for providing resources and support throughout this project.
Be sure to check out the TI-RSLK MAX!
Comments