Wireless microcontroller/PC interface for $3

uc

Sending data from a microcontroller to a PC usually requires some sort of serial connection, either through fiddly on-chip USB, FTDI chips, or expensive radio ICs. [Scott] didn’t want to deal with this when creating a network of wireless temperature sensors, so he hacked up a few cheap 433 MHz radio transmitters and receivers to transmit data to a PC for about $3.

After sensor data is collected on a microcontroller and sent over radio, there’s still the issue of getting it into a PC. For this, [Scott] piped the data into the microphone port of a cheap USB sound card. We’ve seen this trick before both in the world of microcontrollers and loading programs onto a Commodore 64 via a cassette interface.

Once the data is sent into the sound card, it’s decoded with a a small Python app. Given the range and quality of the RF transmitters and receivers  [Scott] says it’s not an extremely reliable way to send data to a PC. It is cheap, though, and if you need to read sensors wirelessly on a budget, it’s hard to do much better.

Check out [Scott]‘s demo of his creation below.

Comments

  1. Addidis says:

    nrf24l01+ modules are pretty cheap. About 2$ on ebay and are remarkably reliable.

    • freak says:

      I’ve been using these too, never had a single problem with them. They’re really worth the two bucks.

    • gr0b says:

      I love nrf24l01+, I pay less then $1USD each for a standard one or about $9 for a higher powered version with PA LNA and SMA ant. I have also found them to have good power consumption levels (about 12mAh @ 3.3V TX/RX)

      • killersquirrel says:

        How bad is the range on those?

        • Addidis says:

          It depends Ive got a few in a wireless thermocouple setup tossing data and displaying on an lcd. My room is full of electronics and wireless stuff (emi etc) and the radios are sandwiched between. With two standards (1$) it usually can span my room. With one hi power SMA and one standard it does a pretty quality job making it the length of the house. I would expect much better performance too, say out in the country , or even rural and not in my lab/room.
          All my results are totally unshielded , with no effort to reduce interference. I wanted to see if it would be ok at an RC track as the setup is a head temperature gauge. For one way you can get away with the SMA version on the receiver.

          • MikeK says:

            You must have a lot of interference. I easily get the length of the house with the lower power ones. I can even get from outside the house to inside the opposite end of the house.

  2. Arlet says:

    I use a USB to TTL serial converter for a simple PC interface. You can get those on Ebay (search for PL2303) for a few $$ from various Chinese vendors.

  3. DFWz33 says:

    This is a COOL hack. very well done!

  4. Matthew says:

    I’ve used a modulated IR LED. It’s line of sight only but still cheaper than any radio solution.

    • SWHarden says:

      My ultimate goal is to try different temperature controller algorithms for a crystal oven which is encapsulated in multiple layers of Styrofoam. While transparent to RF, IR wouldn’t penetrate well… although I did consider it! From the PC side, what is the simplest/cheapest cross-platform way to receive IR?

      • Nova says:

        You could literally wire an ir diode and reciever directly to an rs-232 port via a few resistors and transistors, power it parasitically from the port as well. No ttl or usb adapters needed, but this only works if you still have a serial port. (Some motherboards do support COMs via headers and sometimes an IR plug-in board, I’ve forgotten the name of this but it will require extra programming as its actually designed to be reliable, performs modulation, etc.

  5. Truth says:

    Instead of sending the numbers in reverse after sending them forward, It might be a better idea to send an error correcting code since you can’t tell the transmitter that there was an error in transmission and to resend the data. There is one error correcting code that pops into my head when I hear data, radio and one-way communication – http://en.wikipedia.org/wiki/Mariner_9#Error-Correction_Codes_achievements

    • R-B says:

      Why didn’t he use an USB-UART module (~$2 on ebay) instead of the sound card? It is much easier to program.

      • SWHarden says:

        because I want to use cheap, minimalistic MCUs (ATTiny44A) which don’t have USART. I also don’t want to be locked into tight clock requirements.

        • Sweeney says:

          You only need an ATMEGA328 and crystal clock at the PC end to feed your USB->Serial (a CP2102 will set you back about $1, an ATMEGA328 costs about $2.20 in lots of 5, a 16MHz crystal plus a few capacitors for less than $0.50). You can keep your ATtiny chips at the remote end. Swap the radios for NRF24s (about $1 each) and all your error detection and correction is offloaded, plus they handle clock speed conversion/correction and you can feed data faster than 250,000 bps

          • TacticalNinja says:

            *facepalm*

            He told you what he has, and what he wants. Obviously he would’ve gone your way if he has the parts or decided to go with a more expensive approach, but he didn’t.

          • Sweeney says:

            So showing him (and others who are thinking about the same sort of thing) that the PC end and radios can be done for the same kind of money, without changing remote micro controllers and whatever they are hooked to, and without clocking or interference issues is a bad idea? Was that a facepalm or were you just burying your head in the sand?

        • one says:

          I have been using soft uart at 19200/9600/1200 baud for the past years with internal RC oscillator clocked at 4 or 8 Mhz. Usually on the PIC10F2xx or above. After the project is finished and I am done with debugging I switch to a lower frequency, though this can also be done dynamically if you only need bursts. It might be possible to power everything parasitically from the USB-RS232 converter.

    • mdj says:

      Cool hack.

      “Truth” is correct. This is an error detecting code, not an error correcting. Try using a Hamming code (https://en.wikipedia.org/wiki/Hamming_code). It will send 3 bits as 7 bits and can correct multiple errors. It should be very easy to implement.

  6. sneakypoo says:

    Bluetooth modules are dirt cheap now as well. I recently got a couple from ebay for $7 a piece. Transmission distance was longer than he showed here and you don’t have to worry about false data/noise. Sometimes spending a couple of extra bucks is worth it to avoid headaches.

    But, as a hack it’s neat.

  7. Geebles says:

    Nice! You will probably find that there are other things on that band or that the receiver is picking up a wide range of signals? You may get better results if you use a circularly polarised antenna (maybe this won’t work for 433Mhz? I use it on 5.8Ghz and works great) which should reduce multipathing and rejecting some unwanted data. Have you looked into the NRF24L01? They use SPI so that may be a bit more complicated.. but it does have a ton of features!

    • SWHarden says:

      I haven’t seen any noise on that frequency, but I haven’t looked for too long. Also, I was unaware of NRF24L01 until now – they look fantastic! A little over a dollar each on eBay too. I’ll have to buy a few and check them out…

      • Geebles says:

        I’m currently doing a project with them and they’re great :) There are 2 libraries for Arduino that do a lot of the heavy lifting (Mirf and RR24) and the modules can work 2 way (so theres no seperate ‘transmitter’ and ‘receiver’ hardware to worry about). I got 115200 baud transparent serial working both ways pretty quickly :) But still, manually pulsing bits and reading it the other end is fantastic work! :D

  8. Sounds like it’s screaming out for a simple Winchester encoding scheme, but he never explained what his 1/0 encoding scheme was.

  9. occam says:

    AM radios are notoriously sensitive to interfearance. To minimize bias drift and DC stabilize the receiver, preceded each transmission with a train of 010101… For at least 16 cycles, then a start of message signature, then use Manchester encoding to maintain the DC balance and you will more consistent results. Use a checksum and design your protocol to send frequently so you can tolerate tx errors

  10. sachin says:

    these modules wont work with multiple transmitters active at same time as these are simple ASK modulates. for multiple modules to work together you have to go for Time-division multiplexing which can be pretty difficult if you are powering sensors individually.

    • SWHarden says:

      Since these modules can transmit 700+ data points a second, if I send a few points it will take only a few hundredths of a second. If I send an identifier then the data “bursting” for a fraction of a second every several seconds, yeah every once in a blue moon they’ll chime at the same time and no data will get through, but usually they won’t overlap. This is a simple, cheap way to allow multiple transmitters to send data to the same RX, as long as they loosely take turns.

  11. occam says:

    Instead of mickymousing around get a hope RFM50 SOC module: 8051 + RTX +FM+100mW based on solid SI Labs SOC. about $9

  12. xorpunk says:

    I did long distance this way using DRM for a lab project. It’s not practical till you can source ICs that can handle the bandwidth through buffering or frequency clock.

  13. freelancer says:

    Nice Project!
    For your information, you can get the RFM-01/02 RX/TX-modules for about 4.5 USD each, if you have SPI (raspi?), this is IMHO the cheapest und best solution.
    http://www.pollin.de (example)

  14. Mitch says:

    I tried sending mirror imaged bytes for parity over wireless. I found it’s not as reliable as you would think, I STILL got false positives. I had to actually calculate an odd-bit checksum, and an even-bit checksum and that solved the problem for me. I would bet that the problem is if you sent something like 0b11100111 then the inverse would be identical and any problem interpreting the signal may bleed over to the inverse check.

    Doing an even-odd checksum is beneficial for sending more than 1 byte of data at a time because no matter how long the message, there’s just 2 bytes sent with it.

    In any case. Very cool. I was especially fond of the QT interface. Makes me think I should get back into Qt as my “any OS” programming solution.

  15. gyro_john says:

    Thanks very much for the great demonstration. Now I’d be willing to try these modules if I need something like that.

  16. Mystick says:

    So, this is right in the middle the the 70cm Amateur Radio band… beware the FCC…

    • Sweeney says:

      433MHz is an unlicenced ISM band in Europe and Africa, like the 902-928MHz band in the US.

    • Scott Harden says:

      Thank you for bringing up this topic! I recommend everyone consult the pretty ARRL band chart http://www.arrl.org/files/file/Hambands_color.pdf and observe 420MHz-450MHz is indeed the UHF amateur band in the USA.

      (A) Since the signal is so weak it can’t be detected more than a few feet away, I can’t imagine I’m causing significant interference with amateurs (who mostly operate FM in this region anyway), and as far as the FCC goes I doubt black helicopters will swarm my facility.

      (B) As a licensed amateur radio operator (call sign AJ4VD), I have privileges to transmit
      in this range anyway, so I’m even less concerned.

      (C) These modules can be purchased in a variety of frequencies, so if anyone is truly concerned about using an unapproved radio device in the USA, ease your mind by choosing RX/TX modules which are sold in the USA and specifically certified by the FCC.

      • static says:

        As another licensed amateur I really don’t care about another Amateur’s operation if it doesn’t affect others. Now that was brought up my curiosity became on the probability of others stumbling on the transmissions. While the are voluntary the band plan for 70 cm is voluntary your operation may be in or near the segment for low power CW operation, CW is basically a digital AM whose receiver will hear your signals. In the event your sharing the code meets the FCC definition of “any technique whose technical characteristics have been documented publicly” you are good to go. Anyway it’s always good to read accounts of radio hams experiments, thanks for sharing.

      • sbrk says:

        > (B) As a licensed amateur radio operator (call sign AJ4VD), I have privileges to
        > transmit in this range anyway, so I’m even less concerned.

        I do hope you’re including your call-sign as part of the data transmitted if you are going to operate these under part 97, no greater than every 10 minutes, and at the end of your transmissions, rather than a part 15 “intentional radiator”.

        As far as band plans are concerned, this is the ATV simplex range. They’ll likely not care what you do.

        What we don’t want is someone unlicensed in our band to fire one of these up with a better antenna and/or amplification which would exceed the Part 15 limits.

    • static says:

      I believe Scott is licensed. At these power levels it’s unlikely that interference to others will be caused. As long as his call is in the data stream, the data transmission protocol is a common one isn’t using this for profit he should be fine. However it sounded like he was using a protocol of his own making, if so that might attract the interest of of others amateurs in range of the signals drawing attention to his project.

    • MikeK says:

      The FCC granted use of part of the 70cm band to low power devices, such as those used in outdoor temp sensors.

  17. rasz says:

    What I found impressive was the gui for python code. Made me go out and research QT designer :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,330 other followers