Sunday 21 September 2014

433Mhz RF Transmitter and Receiver

433Mhz RF Transmitter and Receiver.


I wanted a cheap wireless solution, these are great at little over a pound each. 
This is a great instructables on them with all the specs. Limitations are that they easily loose connection with each other, and don't really have enough power to go through more than one wall (on 5v) a max range of 100 M can be achieved with LOS (line of sight) also the direction of the antenna greatly affects performance.


Virtual Wire

The VirtualWire library allows you to easily communicate over RF. Official VirtualWire Documentation (PDF).


Test project

I wanted to control a coffee machine using these the idea was to have a button on my desk with an RGB LED, off: the LED would pulse red, brewing: the led would stay yellow and ready: the LED would pulse green.

First prototype: got the led to work correctly with me pushing the button it would cycle through the colors no problem.

Second prototype: Modified the example Tx and Rx code from virtual wire library to send a 1 then 0 with a second gap in between. added relay to control coffee machine. 

Third prototype: combined both codes into one found that the LED wasn't working as expected it wouldn't display certain colors and i reasoned it was because the Tx part of the code being constantly sent with a small delay- this delay affected the PWM of the LED. To make it work a micro controller able to run two sets of code at the same time would be needed. But this expense is a little overkill for a simple remote coffee machine.

Forth prototype: i simplified the user experience to a simple on/off, green/red operation.
however the leds flash briefly, assume this is when data is being Tx.

Im not going to use these to remotely control my coffee machine as the connection is unreliable and unable to reach the distance to it. I'm going to test these and see if i have better luck, also i need a way of getting 5-12 V from the mains to power the Rx. 


Hardware Connections

Rx Signal Wire to D12

Tx Signal Wire to D12



Code

As i was only sending 1 or 0 i changed the following line in the set up. This is an array that holds the data you want to Tx.

char Sensor1CharMsg[2];

This line converts an integer array to a character array.

 itoa(ButtonData,ButtonCharMsg,10);
 
Great information on converting CHAR to INT and vice versa.

No comments:

Post a Comment