So I bought some 433mHz modules off of eBay for dirt cheap. The “standard” 4 pin receiver and 3 pin transmitter. For the life of me I could not get them to work. Everything I found online appeared to be related to the RPi A I am pretty sure because NONE of the instructions worked for me. I was able to download, compile and run the commands but with zero results. I tried damn near all tutorials I could find out there. Nothing work but I did get close a few times. The part that really irritated me was that I had hooked up LEDs to the Tx and Rx pins to see if it was working. It was, I could see the LEDs flicker away when I pressed buttons, but no results with sniffing.
Finally I was able to send and receive a signal. RFSniffer finally worked off of pin 13/GPIO 27/wiringPi 2 on my Raspberry Pi B+. I curse the people that decided to use a completely different number schemes!! I used this http://shop.ninjablocks.com/blogs/how-to/7506204-adding-433-to-your-raspberry-pi to get the sniffer working, with the above pins, but without the ninja block stuff.
I don’t have FTDI, it hasn’t arrived yet, so I used my Arduino Duemilanove to flash the Mini Pro, but it didn’t work. To get the Arduino Mini Pro to flash I had to switch the Tx and Rx pins. You will find all the directions out there say to connect the Arduino’s Rx to the Minis Tx and vice versa, but that was not the case for me. I did find one post on the Arduino forums that mentioned switching them, I had to flip-flop the pins and then it worked! Tx to Tx and Rx to Rx. I got my Mini Pro off eBay for cheap, it has no name on it, but it does have a red PCB and a small Sparkfun logo. Works like a charm this way. Just remember to set the Arduino IDE to your Mini Pro or you will get errors. I also HAD to remove my Duemilanove’s chip to flash the Mini. I tried it with it in and it did NOT work.
As for the receiver some say to use 5v to power, the board even says 5v. But I have also read people using 3.3v to power it. I used 3.3v to power it when I was testing. To use 5v and the RPi you need to drop the voltage or you will damage the Pi. Use a voltage divider with a 1K and 2K ohm resistors to do it. Google Images has plenty of examples. http://forum.arduino.cc/index.php?topic=136788.0
Heres the code I used to finally get it to work:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
/* Example for different sending methods http://code.google.com/p/rc-switch/ Need help? http://forum.ardumote.com and Turns on and off a light emitting diode(LED) connected to digital pin 13, when pressing a pushbutton attached to pin 2. The circuit: * LED attached from pin 13 to ground * pushbutton attached to pin 2 from +5V * 10K resistor attached to pin 2 from ground */ #include <RCSwitch.h> RCSwitch mySwitch = RCSwitch(); const int buttonPin = 9; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin int lastButtonState = 0; int buttonState = 0; // variable for reading the pushbutton status void setup() { Serial.begin(9600); // Transmitter is connected to Arduino Pin #10 mySwitch.enableTransmit(10); // Optional set pulse length. // mySwitch.setPulseLength(320); // Optional set protocol (default is 1, will work for most outlets) // mySwitch.setProtocol(2); // Optional set number of transmission repetitions. // mySwitch.setRepeatTransmit(15); // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop() { // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // compare the buttonState to its previous state if (buttonState != lastButtonState) { // if the state has changed, increment the counter if (buttonState == HIGH) { // if the current state is HIGH then the button // wend from off to on: /* using decimal code */ /* this code is working with RPi 433mhz, 4 digits reveived */ mySwitch.send(1001, 24); //delay(1000); //mySwitch.send(5396, 24); //delay(1000); } else { // turn LED off: digitalWrite(ledPin, LOW); } } lastButtonState = buttonState; } |
———————
(1) Raspberry Pi B+
(1) XY-MK-5V 433mHz Receiver (4 pins, both data are the same)
(1) Arduino Mini Pro
(1) FS1000A 433mHz Transmitter (3 pins)
RFSniffer (on the RPi for receiving)
RCSwitch (on the Arduino for transmitting)
I used 2 LEDs on the Tx and Rx data pins, and 10K ohm pulldown resistor for the button. I also soldered on 17cm (about 6.5″) of 22awg solid copper wire for antennas.
———————
Some useful links
http://arduino.cc/en/Tutorial/ButtonStateChange
So far so good. Do not blame me for anything bad that happens to you or your RPi/Arduinos, consider yourself warned. Double check your wiring!!
Discover more from Its_All.Lost
Subscribe to get the latest posts sent to your email.