RF transmission and reception of analogue signal

Hi there! :)

My project is about having multiple sensor inputs and transmitting the data through RF transmission. I use the CD4067B multiplexer to control the amount of inputs and I'm fine with that. I also used the Virtual Wire library to test the simple transmitter receiver code and that is also fine.

I just have a problem with approaching the transmission of these input signals. I don't know how to merge the codes into each other. Any help? I'm using the multiplexer for 4 different inputs through four channels. These appear on the Serial monitor. I want to transmit those signals through RF transmission.

Please let me know if any help can be given.

Cheers,

Feda

Attached is what i want to transmit through the RF transmitters. Help this is more clear.

4 channels.png

Are you wanting to feed this data through an Arduino to the RF module? or straight to the RF module? What Rf Module?

Sparkfun has some RF modules that will transfer a serial stream.

I want to transmit this from the arduino uno to the transmitter–> receiver and then arduino again, so I can see the receiving end through the serial monitor. I’m using the RWS-371 RF receiver and the TWS-BS Transmitter. Attached are the data sheets of both. Any ideas?

rf-transmitter-434mhz-technische-datasheet.pdf (292 KB)

RWS-371-6_433.92MHz_ASK_RF_Receiver_Module_Data_Sheet.pdf (259 KB)

This is the code that displays the four input channels… All I need to help with is how to merge this code into the Virtual Wire transmit receive code? Complicated?

CODE

const int firstAddressPin = 8; /// the address pins will go in order from the first one:

void setup() {
Serial.begin(9600);
// set the output pins, from the first to the fourth:
for (int pinNumber = firstAddressPin; pinNumber < firstAddressPin + 4; pinNumber++) {
pinMode(pinNumber, OUTPUT);
// set all the address pins low
//to connect input 0 to the output:
digitalWrite(pinNumber, LOW);
}
}

void loop() {

//loop over all the 4 input channels
for (int thisChannel = 0; thisChannel < 4; thisChannel++) {
setChannel(thisChannel);
//read the analog input and store it in the value array:
int analogReading = analogRead(0);
//print the result:
Serial.print(thisChannel, DEC);
Serial.print(" = “);
Serial.print(analogReading, DEC );
Serial.print(”\t");
}
// linefeed after channels appear
Serial.println();
delay(1000);
}

//Which channel connected to the output:

void setChannel(int whichChannel) {
// loop over all four bits in the channel number:
for (int bitPosition = 0; bitPosition < 4; bitPosition++) {
// read a bit in the channel number:
int bitValue = bitRead(whichChannel, bitPosition);
// pick the appropriate address pin:
int pinNumber = bitPosition + firstAddressPin;
// set the address pin
// with the bit value you read:
digitalWrite(pinNumber, bitValue);

//Serial.print(bitValue); to check if correct bits

}
}

You'll need to create your own "protocol" for this. You need to package up the data in whatever format you wish, as an array of bytes to send across the RF through VirtualWire. A good start would be to add a couple identifier bytes to the beginning so that you know what it is and what to do with it. You have a few options in that you could send actual values or a string, you'll just need your receiver to know how to read and parse the packet.

Thanks! I understand what you said fully. Yet, since I haven’t faced such problem before … I don’t have an idea on how to approach it. Any quick start hints? Anything that would make what you said simpler to implement?

Cheers

Another thing, since the data is read through the analogRead() function how am I supposed to wire the RF transmitter to the output of the CD4067B multiplexer? Where only 1 pin on the multiplexer is the output and that goes to the A0 pin on the UNO microcontroller?

Feda: Thanks! I understand what you said fully. Yet, since I haven't faced such problem before .. I don't have an idea on how to approach it. Any quick start hints? Anything that would make what you said simpler to implement?

Cheers

Well, you've managed to package the data into a string that is printed to your serial monitor, so you can start there. Use sprintf instead of all the Serial prints to "package" it into a packet. From there, you just have to send it through the RF transmitter. On the receiver end, you have to parse the string to get the values. Use a combination of strtok and and atoi to extract the data.

Feda: Another thing, since the data is read through the analogRead() function how am I supposed to wire the RF transmitter to the output of the CD4067B multiplexer? Where only 1 pin on the multiplexer is the output and that goes to the A0 pin on the UNO microcontroller?

VirtualWire uses digital pins, not analog ones.