Previous posts for this project:
- [AirCare] InTheAir - Project Description
- [AirCare] InTheAir - Week 1: Getting a Launchpad to Blink
- [AirCare] InTheAir - Week 2: Preparing the Beaglebone Black
- [AirCare] InTheAir - Week 3: Fuel Tank Testing
- [AirCare] InTheAir - Week 4: Using the CC3200
- [AirCare] InTheAir - Week 5: openHAB and MQTT
- [AirCare] InTheAir - Week 6: Accessing Fuel Tank's Data
- [AirCare] InTheAir - Week 7: Dust sensor
- [AirCare] InTheAir - Week 8: MSP430FR5969 with Energia14
- [AirCare] InTheAir - Week 11: CC3200, Energia and analogRead()
- [AirCare] InTheAir - Week 12: Automatically starting some things
- [AirCare] InTheAir - Week 13: GP2Y10 BoosterPack
- [AirCare] InTheAir - Week 14: Ordering Parts and PCBs
- [AirCare] InTheAir - Week 16: CNC Milling
Introduction
As I mentioned in my previous post, I've been trying to get the control of a dimmable power socket to work via the Launchpads. I moved on to plan B until I manage to spend more time to crack the code.
I then hooked up the Launchpad to the Beaglebone black over UART and configured openHAB in order to control the fan which will be in charge of filtering the air.
Plan A
Plan A sounded simple at first:
- go to the hardware store
- buy a remote controlled dimmable socket
- analyze the signal
- reproduce with Arduino/Launchpad
Going to the hardware store and finding a dimmable socket was the easy part.
I underestimated the signal analysis and reproduction though ...
When analyzing the signal, I noticed there were different sequences being sent out to the 433MHz transmitter, as opposed to a single sequence repeated multiple times with the regular ON/OFF sockets.
I did my best to reproduce the signal, but haven't succeeded so far. I also searched for alternatives such as using an Arduino with 433MHz receiver and a sniffer sketch, but that didn't help either.
A lot of time was lost trying to figure this out and trying different things. I want to be able to crack the code as being able to control such dimmable sockets will certainly be useful for future projects, but I had to park it for now.
Plan B
OK, with Plan A temporarily set aside, it was time to move to Plan B: regular ON/OFF sockets without dimmer.
I have worked with those before, in the FMN challenge and managed to reproduce the sequence of pulses using an Arduino. Knowing that, it shouldn't be too different using a LaunchPad, right ? Well, I was wrong (a little bit).
void writeOne() { digitalWrite(pin,HIGH); delayMicroseconds(940); digitalWrite(pin,LOW); delayMicroseconds(300); } void writeZero() { digitalWrite(pin,HIGH); delayMicroseconds(290); digitalWrite(pin,LOW); delayMicroseconds(950); }
After loading the Arduino sketch from before onto the MSP430FR5969 Launchpad, nothing happened. The socket would not turn ON.
Booted the scope to have a look at the pulses and there they were. So why wasn't it working ?
Taking a closer look, the timing seemed completely off. A pulse that should have been HIGH for 0.940 ms only lasted about 0.140ms. What ?!
I searched the world wide web for answers and came to following post: http://e2e.ti.com/blogs_/b/msp430blog/archive/2015/01/20/using-the-msp-exp430fr5969-launchpad-at-16mhz-in-energia
It is suggested that for timing critical application (which this one is), the Energia config needs to be adapted to have the MSP430FR5969 core run at 16MHz instead of 8MHz. This requires a small modification in the "boards.txt" file in the Energia installation folder.
You can either uncomment the 16MHz and comment out the 8MHz or, duplicate the board definition, give it a different name and have one at 8MHz and the other at 16MHz. After making the changes, I restarted Energia and had two MSP430FR5969 to choose from. After uploading the sketch using the 16MHz variant, the timing was correct and my socket could be turned ON and OFF.
Control
The control the fan, I have a 433MHz transmitter module attached to the MSP430FR5969 which in turn is controlled by OpenHAB on the Beaglebone Black over UART.
This is the connection diagram between the MSP430 and the BBB:
MSP430FR5969 | Beaglebone Black |
---|---|
Ext Power VCC | P9-3 (3.3V) |
GND | J1-1 (GND) |
P2.6 (UART1 RX) | J1-5 (UART0 TX) |
P2.5 (UART1 TX) | J1-4 (UART0 RX) |
Note: Don't forget to set the "Power Select" jumper to "External".
I then proceeded to configure openHAB with the serial binding, just like I did in the Forget Me Not Challenge: [CaTS] ForgetMeNot - Week 4: Arduino-OpenHAB communication
The only difference, is that instead of /dev/ttyACM0, it should be /dev/ttyO0.
With everything configured, it was now possible to turn the power socket ON and OFF from OpenHAB. This will later be triggered automatically by a rule, depending on the measured amount of dust.
I've used a small fan for testing, but will be using a bigger one with a filter attached to it, for the final setup.
The pieces are finally coming together, and with only two weeks remaining in the challenge I'm glad things are starting to work.
Vote
Your vote counts! If you like my project or anyone else's, don't forget to vote for it! Community Choice Poll - In the Air Challenge
Top Comments