I have an Arduino Uno which is going to receive a long binary string. I know that this string will correspond to English when decoded. How can I convert the incoming binary string to text, so that I can read it in the Serial Monitor?

Bonus Points: This string will almost definitely have random noise digits. How would I noise-proof the string, or how could I have the code detect and ignore noise?

UPDATE: It might help if I mention my end goal. So I have this contained clean space that is locked up to avoid contamination. It is quite small, and used for growing silicon crystals. I want to be able to take a greyscale image every hour, and transmit it to a receiver on the other end of the room, through a window. The window is two half inch panes of glass with an inch of space between them. I have on hand 2x Arduino Uno, 1x Arduino Beetle, and 1x Raspberry Pi. The whole text string thing is just for testing purposes so that I can understand what I'm doing. From what I've read on the subject previously, I need to take the image, convert it to Hex, convert that to binary, transmit it, receive it, convert back to Hex, convert back to an image. I have 0 experience with Arduino or Raspberry, have a limited idea of how to execute this, and appreciate all the help I can get!

  • 2
    Can you define 'binary string'? And can you explain 'read it in the serial monitor'? You want to receive it by RX or print it to the serial monitor? Or receive it by typing it in the serial monitor? You can noise-proof it by adding CRC data. Commented Jun 27, 2017 at 20:48
  • So, I'm using the transmitter and receiver pair from here. The transmitter is transmitting the string corresponding to "Hello World", where the string is generated by converting each ASCII character into its 8-bit binary string. The string received by the receiver ought to be one long line of binary generated by the conversion code, but with noise. What I mean by "read into serial monitor" is that I want to decode it from binary back into "Hello World", and print it out to the serial monitor so that I can verify it worked. Commented Jun 27, 2017 at 20:52
  • Can you run a wire out of the clean space? Eg, put camera inside, and wire to RPI outside? ¶ If electronics are inside sealed space, is it at atmospheric pressure and room temperature? Ordinary Arduino and RPI boards will outgas below atm. ¶ Might also look into power line modulation to piggyback signals out of sealed space. ¶ If you have to use RF, put receiver a few inches from the transmitter and use wire to get the rest of the way across the room. ¶ Can you transmit light through the glass? Eg, put an LED on system inside space, and a phototransistor just outside, etc. Commented Jun 28, 2017 at 13:35
  • I cannot run a wire out. We want to have complete containment, and not fiddle with making a hole in the setup, feeding a wire, and sealing the hole. It will be standard Earth atmosphere and ranging from room temp to a really hot day (~95-100 F). Due to equipment and room setup, the closest the receiver can be is 30'8". Light cannot propagate through the glass. I do like where your head is with using the LED as an Aldis lamp, but that won't work, because all receiver stuff needs to be at least 30'8" away from the containment unit, and that signal could easily be interrupted at such a range Commented Jun 28, 2017 at 15:12

2 Answers 2


Perhaps you have asked the wrong question. Because there is a library for those cheap 433MHz modules: RadioHead.
Use the RH_ASK mode, and try the 'ask' examples

You might see VirtualWire used a lot with those 433MHz modules. That is the same as RadioHead. The RadioHead is newer and has a few bugs fixed, but it uses also more memory.

The RadioHead library uses a far more superior protocol than anything else, that makes the range better than with other libraries. It also has a (simple) CRC checksum in the protocol. That means that when you receive something, you can be (almost 100%) sure that the data is correct.

Other protocols require that a message is transmitted 10 times, to be sure that it will be received. With the RadioHead library, sending a message just once is good enough.

Those cheap 433MHz modules have a disadvantage: they can only be turned on and off (ASK modulation) en you need a library for the protocol. That means that if the Arduino is doing more things that uses interrupts or code that disables interrupts, then the protocol is disturbed and it will not work very well.
The RF transceiver modules have a chip on the module itself that takes care of the protocol, that is so much better. Sparkfun has a Wireless Buying Guide and Adafruit uses the RFM69 a lot.

Those cheap modules require an antenna, or else the range could be less than the size of the table they are on. Solder a 16cm piece of wire to the antenna pin. Any piece of wire of any length is better than no antenna.

  • So, I'm actually using VirtualWire already. I looked into using RadioHead, but I don't think that my project will allow me to have enough memory to use it. My primary concern is space, because my final physical build needs to fit a theoretical space of 25mm X 25mm X 30mm. I don't think I'd have room for an antenna, so I should look into a different transmitter. I'm still not sure how to write a program to convert the incoming binary string to text (or in my case, Hexadecimal, then an image). Commented Jun 28, 2017 at 12:37
  • With VirtualWire or RadioHead you will receive the same bytes as what you have sent. There is no need to convert something. The typical data transfer rate for those cheap 433MHz modules is about 10 to 100 bytes per second. It is not for transmitting an image.
    – Jot
    Commented Jun 28, 2017 at 12:49
  • Oh, I thought they could do images. Do you have any ideas on what would be the best method for transmitting an image at range? Commented Jun 28, 2017 at 15:13

A string is also a 8-bit 'binary' string ... so I don't think you need to do anything special... if you can read byte by byte, you might have to construct a string adding the characters, or print it directly to the serial monitor (last is even better because you don't have to think about memory).

If the 8-bit binary string does not contain ASCII data (which I doubt), print out the byte values as number and see how it should be converted to a textual character.

Noise is a bit more tricky .. afaik it is possible with some libraries (for the RF) to automatically resend. If that is not good enough, you have to make your own CRC ... calculate a CRC, send it (maybe a few times to be sure there is no noise in the CRC) and check it against the received string; if not received correctly, send it again.

If you have only 1 directional transmitting, than it is more tricky. You can add extra bits to 'fix' noise, or using special schemes for it.

See for more info wikipedia

  • So, would I just tell it to constantly receive data, and every eighth digit attempt to convert the 8-bit string to a char? Commented Jun 28, 2017 at 12:38
  • You will get bytes, not bits, and one byte is one character ... so the data you sent with the Wire library (or another) will be the same that you receive on the other end, assuming the connection quality is good enough. Commented Jun 28, 2017 at 13:48
  • you're welcome (please upvote if the answer helped you) Commented Jun 28, 2017 at 15:14
  • I did, but I'm <15 rep, so it doesn't show Commented Jun 28, 2017 at 15:21
  • No problem, you always can do it for all your answers you received when your reputation rises :-) Commented Jun 28, 2017 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.