A couple of weeks ago, I decided to build a Portable Radio as IPASS project. This includes using HWlib, which is written by a teacher, and writing every other piece of code needed. The written libraries include libraries for the following chips.
- 24CXX I2C EEPROM
- Rotary encoders
The title also tells it’s “portable”. For that to be the case you’ll also need some sort of battery (albeit an 18650, LiPo or AA batteries in series), TP4056 (a module to charge 18650’s) and a step up converter (MT3608) to make the outputted 3,7V go up to 7V (for powering via the Vin pin on the Arduino Due). For basic functioning, we’re done with required materials. For the solar panel though, we also need a step down converter to change the outputted voltage from 12V to 5V. The solar panel can then be connected to the Vin pin on the TP4056.
The TEA5767 and RDA5807M chips are FM-chips. The TEA5767 is the oldest of the two, whereas the RDA5807M is very modern and also supports the Radio Data System. The DS3231 is well known, it doesn’t need that much of an explanation. For the ones that don’t know; it’s a real time clock module also supporting alarms. The 24C256 (and other 24CXXX chips) is an I2C EEPROM chip. The written library takes care of every single problem that’s introduced when using the chip. The rotary encoders are pretty straight forward; the output a grey code.
You can take a look at my GitHub repository to check out examples, the code and further information. There’s also a video in which I showcase the functionalities of the finished project. Be sure to check that one out!
The written libraries are very well documented using DoxyGen. If you’re familiar with it, you can easily generate the documentation yourself. Otherwise, you can download the already generated documentation here. The documentation written for DoxyGen is also readable without generating the documentation.
The wiring looks complex, but in reality, it really isn’t. A large part is power supply as described in the overview. Another complex looking part are the speakers and radio chips. The TEA5767 and RDA5807M are controlled through I2C. They both have a L and R audio output for stereo audio. The audio outputs on these chips are connected to the PAM8403 where they are amplified and send to the speakers. For the amplification to happen, the PAM8403 needs a supply voltage of 3 to 12V. It can draw up to 2A of current with the used speakers. So for full output power, the PAM8403 supply voltage comes directly from the 18650.
The OLED, DS3231 and 24C256 are controlled through I2C and the rotary encoder outputs a grey code. See? The diagram is large, but not complex.