Now that picoEngine has reached version 1.0, I’m ready to work on a few other projects. Namely some electronic ones. Since Christmas, I’ve been holding on to a few Arduino Uno boards, and a pile of stuff for them. So, I broke out a few parts.
I decided to start with the 433MHz transmitter and receiver.
There were several guides online, and I stole some code from them. I like starting any project with a known good source before stepping out into something I made, to make sure the hardware/software is set up properly. It was a great tutorial, and it worked.
However, there was one unexpected drawback: range. I knew these little transmitters and receivers were weak, but I didn’t realize that they literally only transmit an inch! As you can see in the picture, the Uno boards are almost touching just to transmit the data back and forth. I had purchased a few of these (three sets for myself, and two for my brother) with the intention of doing a few fun projects. Unfortunately, these wont transmit across my desk, let alone the parking lot, so I’ll need something else to work with.
But, these are still a fun learning tool, just a little lacking in the range department! Here are the sketches I used, keep in mind, you need the “radiohead library” installed in your IDE to make this work.
Transmitter:
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compileRH_ASK driver;
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println(“init failed”);
}void loop()
{
const char *msg = “Hi World!”;
driver.send((uint8_t *)msg, strlen(msg));
driver.waitPacketSent();
delay(1000);
}
Receiver:
#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compileRH_ASK driver;
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println(“init failed”);
}void loop()
{
uint8_t buf[12];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen)) // Non-blocking
{
int i;
// Message with a good checksum received, dump it.
Serial.print(“Message: “);
Serial.println((char*)buf);
}
}
I certainly like the simple code, since the radio head library does all the heavy lifting for you. Have any of you ever tried these out?
Linux – keep it simple.