For years I've been using my old looking replica of Bush TR82 radio to listen our local radio stations, but recently I decided to push its reception limits a bit further and upgraded it with help of Raspberry Pi to an Internet Radio.
So, with some extra components from a few broken things now it looks like this:
Actually, it is not just a radio anymore - it is a weather station as well :) It monitors and displays current temperature, pressure and relative humidity. Why? Just because after connecting screen and control buttons I still had a few IO pins available plus it will help me in future to build intelligent house heating system
Some new exterior features:
Screen (used to be Nokia 3210 phone) displays 6x14 lines (from top to bottom):
If radio is in Internet mode, screen is highlighted by blue LEDs (used to be Logitech G-15 keyboard).
Control buttons (used to be Canon 300D camera) allows to select different radio stations from a play list or to bring up control menu with some system info (CPU load and network transfer rate):
There is also a simple CLI to control some functionality remotely or to get sensors reading:
Rear side has a window for Temperature/Pressure/Relative Humidity sensors:
The window is covered with a mesh which used to be office paper holder.
Raspberry Pi itself is located in radio's battery compartment:
Flat cable connects RPi to a board fastened inside to top of the battery compartment:
Shielded power supply for RPi sits beside radio power transformer. Note a power switch I've added (used to be table lamp switch).
Front panel with a bit of hot glue and insulation tape to hold screen and buttons:
List of main components used:
Third party software:
Next steps:
So, with some extra components from a few broken things now it looks like this:
Actually, it is not just a radio anymore - it is a weather station as well :) It monitors and displays current temperature, pressure and relative humidity. Why? Just because after connecting screen and control buttons I still had a few IO pins available plus it will help me in future to build intelligent house heating system
Some new exterior features:
Screen (used to be Nokia 3210 phone) displays 6x14 lines (from top to bottom):
- Current mode (Radio if Internet Radio mode is on or current relative humidity), WiFi signal strength, current time
- Radio station name
- Current song title (scrolls if does not fit to 14 characters)
- Current temperature and pressure.
If radio is in Internet mode, screen is highlighted by blue LEDs (used to be Logitech G-15 keyboard).
Control buttons (used to be Canon 300D camera) allows to select different radio stations from a play list or to bring up control menu with some system info (CPU load and network transfer rate):
There is also a simple CLI to control some functionality remotely or to get sensors reading:
Rear side has a window for Temperature/Pressure/Relative Humidity sensors:
The window is covered with a mesh which used to be office paper holder.
Raspberry Pi itself is located in radio's battery compartment:
Flat cable connects RPi to a board fastened inside to top of the battery compartment:
Shielded power supply for RPi sits beside radio power transformer. Note a power switch I've added (used to be table lamp switch).
Front panel with a bit of hot glue and insulation tape to hold screen and buttons:
List of main components used:
- Raspberry Pi Model A with WiHi dongle
- Nokia 3210 screen
- MPL3115A2 Pressure/Temperature Sensor breakout
- RHT02 Relative Humidity/Temperature Sensor
Third party software:
- mpd as media player
- mdpclient library to control mpd
- bcm2835 library by Mike McCauley to read/write IO pins and to communicate with MPL3115 sensor which uses I2C with repeated start.
Next steps:
- add FM transmitter to broadcast Internet stations :) Sony-Ericsson MRR-70 is very cheap I2C controlled FM transmitter which can be integrated easily
- add history for all sensors readings and present graphs on a web page
I'm really interested to see how you control the MPL3115 as I've been battling this for a couple of days.
ReplyDeleteFollowing your lead I installed the bcm2835 library but even Mikes examples I can't get working, all I/O reports NAK.
I know the device I have is OK, its on a Sparkfun breakout board with builtin pullups and works fine on Arduino.
Any insight gratefully received.
Hi,
DeleteI've created new repo https://github.com/achilikin/mpl3115 with two header files. Example main() is in readme.md, have not tried it, just created extraction from my code for the radio. Let me know how it works for you.
Regards,
Andrey
Thanks for the help.
DeleteWhen I run the code I get
++++++++++++++++++
Invalid device ID: 01, must be C4
t=200.88 P= 0kP
+++++++++++++++++
i.e. in mpl_config the rpi_i2c_read_reg returns NACK
so nothing has changed.
I know the device is hooked up OK because i2cdetect shows device address 0x60 present (have to do modprobe i2c_bcm2708, modprobe i2c-dev for that to work.
How did you hook up the mpl3115, with discrete pullups or is it in a breakout board?
Regards, David
Actually I removed pullups from Sparkfun breakout board, so I use pullups which are on RPi itself. As I remember, initially I had some problems with this breakout but it turned out to be just a bad connection on my breadboard.
DeleteI have spare MPL3115 breakout board so I can try it sometime this week whith my example code and will let you know.
Regards, Andrey
Just tried it - works perfect. I've added main.c and Makefile to the repo.
DeleteThis time I did not modify breakout, just connected it to RPi.
Actually i2cdetect does not detect MPL3115A2 sensor, because of repeated start? In your case it detects it, so maybe your version does not require repeated start? You can try to remove RPI2C_RS_READ from mpl_config() and rpi_i2c_read_regs() call in the main.
Regards, Andrey
Hi Andrey,
ReplyDeleteWell thats weird. First I ran it out of the box and got 0 for both temp & pressure.
Then I removed RPI2C_RS_READ as you said and got 0xEE for ID instead of 0xC4.
So I replaced RPI2C_RS_READ and now get 0xC4 and correct temperature & pressure.
Being curious I removed RPI2C_RS_READ again but it still works fine.
Finally, I powered down the board and powered it up again and it still works fine.
The bottom line is that it works for which I'm eternally grateful, buts its niggling that I don't still do't fully understand what happened.
Thanks again,
David