Solved: Transferring sensor data from arduino to arduino over audio line?

I have an rc plane with FPV camera. There is an unused audio line in the AV transmitter, tested with a microphone and working.

Now for testing purposes I would like to install a small Arduino (nano or pro micro or whatever i happen to have) with a thermometer to the plane, and another Arduino with a display on the ground.

Everything else is familiar to me, but the actual data encoding and decoding. The transfer rate is almost irrelevant; if I get three updates of 50 bytes per second, it's plenty.

The VirtualWire and the RadioHead in RH_ASK mode are for cheap 315/433MHz transmitters and receivers.

Those libraries are not only for wireless transfer of data, but it can be used with audio and light signals as well. The used protocol is very good, with a checksum.

The 315/433MHz receivers have an auto-gain. I don't know if you can make a good signal from the audio.

There are a few disadvantages: - The VirtualWire works but no longer supported. The RadioHead has a few bugs fixed, but uses more memory. - The signal from the receiver is connected to an interrupt pin of the Arduino. The Arduino is most of the time busy with that interrupt. - The complete protocol is done in software. If you use code or a library that turns off the interrupts for some time, it might cause problems.

Is there an unused digital channel as well ?

No, there's only analog video and audio channels. It would be a bit too easy if there was a digital channel also. :)

And after overloading google quite a bit, my connection filnally works. Just a first sputnik-like test, but it works.

http://translate.google.com/translate?js=y&prev=_t&hl=en&ie=UTF-8&layout=1&eotf=1&u=http%3A%2F%2Farms22.blog91.fc2.com%2Fblog-entry-350.html&sl=auto&tl=en

Transmitting Arduino:
-TM1637 display, pins 10 and 11
-Pin 3 is sending data with modem.write(temperature);

#include <Wire.h>
#include <Arduino.h>
#include <TM1637Display.h>
#include <SoftModem.h> // include library 
#include <ctype.h>
#define CLK 10
#define DIO 11
SoftModem modem; // Create an instance of SoftModem
TM1637Display display(CLK, DIO);

int humidity = 2, temperature = 1;

void setup()
{
  Serial.begin (57600);
  modem.begin (); // call begin with setup ()
}

void loop()
{
  display.setBrightness(0x0f);
  for (int i = 0; i < 100; i++) {
    temperature = i;
    display.showNumberDec(temperature, false);
    modem.write(temperature);
    delay (800);
  }
}

Receiving Arduino:
-16x2 LCD display, pins A4, A5
-Pin 6 is receiving data

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SoftModem.h> // include library 
#include <ctype.h>

SoftModem modem; // Create an instance of SoftModem

#define BACKLIGHT_PIN     13

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
int humidity = 2, temperature = 1;

void setup()
{
  pinMode ( BACKLIGHT_PIN, OUTPUT );
  digitalWrite ( BACKLIGHT_PIN, HIGH );
  lcd.begin(16, 2);              // initialize the lcd
  Serial.begin (57600);
  modem.begin (); // call begin with setup ()
}

void loop()
{
  while (modem.available ()) { // Check if data is being received from the iPhone
    int c = modem.read (); // 1 byte read
    Serial.print (c, HEX );
    temperature = c;
  }

  lcd.home ();
  lcd.print ("Temperature ");
  lcd.print (temperature);

  lcd.setCursor ( 0, 1 );
  lcd.print ("Humidity ");
  lcd.print (humidity);

  delay (800);
}

It can be tested with a wire from transmitter Arduino pin 6 to receiver Arduino pin 3 (and ground to ground obviously).

It also works by connecting transmitter Arduino pin 6 to audio transmitter (remember the ground too and use a potentiometer to lower the signal level to microphone levels).
And receiver Arduino pin 3 to audio receiver (and ground).

Do you have a link to that modem library? I'm curious on how this one works.

Modem was the first thing I thought of when I read your post. That's how we did data over phone lines in the good old days. Then scrolling down that was exactly the solution :)

That is a nice library, I didn't know it. It uses the comparator mode, which generates an interrupt.

@Sivonen, If that is good enough for you, then there is no need to go to VirtualWire/RadioHead. I would add a checksum to be sure that the data is correct.

@wvmarle, In the Arduino IDE, in the Library Manager is the "Softmodem" by arms22. This is the github page: https://github.com/arms22/SoftModem