[SOLVED] Trouble connecting Arduino to DFRobot APC220

Hello all,
I am trying to set up wireless communication between two Arduinos via DFRobot APC220 radio modules. The simplest thing I want to see is: I press a button on one Arduino, the other one flashes the LED. Here is my setup:
Code for Arduino 1 (the transmitting one):
Code: Select allint ledPin = 13; int myPin = 3; int prev=LOW; void setup() { pinMode(ledPin, OUTPUT); pinMode(myPin,INPUT); Serial.begin(9600); } void loop() { int a=digitalRead(myPin); if( a==HIGH && prev==LOW ){ digitalWrite(ledPin,HIGH); // short flash to confirm button press delay(100); digitalWrite(ledPin,LOW); Serial.write(50); // send one byte } prev=a; delay(100); }
Code for Arduino 2 (the receiving one):
Code: Select allint ledPin = 13; void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); } void loop() {} void serialEvent(){ int b=Serial.read(); if(b>=0){ if(b==50){ digitalWrite(ledPin,HIGH); // long flash to confirm correct reception delay(500); digitalWrite(ledPin,LOW); }else{ for(int i=0;i<3;i++){ // three short flashes to indicate error digitalWrite(ledPin,HIGH); delay(100); digitalWrite(ledPin,LOW); delay(100); } } } }
It doesn't work. I press the button, the first Arduino flashes, the second Arduino does nothing. I tried connecting them by wires: GND to GND and TX to RX, this way it works, but wirelessly it doesn't.
How can I find out where is the problem? Does the first APC220 understand my signals, does it transmit anything, does the second one receive something from the air?Are both APC220 devices ready to work upon applying power to them?Do I just need to send bytes to Serial and they will come out on the other side? Or should I use AT commands or something?I did not connect the EN pin, but it is "high" by default, so the device should be always on.The default baud rate of APC220 is 9600, so I am starting Serial with this value.On my APC220, pin 6 is marked AUX. In one datasheet, pin 6 is described as "MUX - expanded for other functions"; in another datasheet and in the wiki, it is "AUX - Receive (low) Transmit (high)". Should I use this pin? I tried to connect it to VCC on the transmit side - still no luck.I connected both APC220 to computer and set them up via RF-Magic. I have set them to the same frequency, keeping all other parameters unchanged. There are some mysterious settings like "parity" and "stop bits". Should I worry about them from the Arduino side?
Am I missing something obvious?
Hi,
The hardware connection is missing an important part to make the APC220 work. The 'EN' pin is used to switch the APC220 module from sleeping mode to working mode. So you need to connect the EN pin as the IO expansion shield v5 driving circuit for the APC220 interface. Please take a look at the J15 connector and try to test it again! IO expansion shield v5 schematic: https://www.dfrobot.com/image/data/DFR00 ... %20SCH.pdf
Regards,
Lauren

SOLVED! ;D
For some reason I had set the radio frequency of APC220 to 460 MHz which is outside the allowed range. Probably because the RF-Magic program was showing 470 MHz by default, I thought it to be the current APC220 frequency and decreased it. Though, it didn't work even before RF-Magic; probably because I had RX and TX connected in the wrong way at that moment.
So, the schematic above is correct. After setting the frequency to 450 MHz it started working. The EN and AUX pins are not required. (Though, I will use EN later to save battery power). If something doesn't work, double-check RX-TX wiring (always connect criss-cross!) and check the radio frequency range.
By the way, the "APC220 manual" available from the shopping page indicates wrong frequency range.
[quote="Ricky"]From your connection diagram, please power your apc220 @5V. I can't see your supply voltage.[/quote]
I'm using four Ni-MH rechargeable batteries, it gives ca. 5.4 V.

As Lauren said, try the rfmagic software to make sure two apc220 has same baud rate and frequency channel.
From your connection diagram, please power your apc220 @5V. I can't see your supply voltage.

Try to set the both of the APC220 module to the default mode!

[img]
But here I don't want Arduino to be reset, I want to do the opposite: send data from Arduino to the radio module. As far as I understand, the APC220's EN pin and the Arduino's RST pin are both input-only, and both seem to be "pulled up" by default. How will it work for me?
Though, I will try it anyway. Thanks for the suggestion.


In the datasheet it's stated that EN should be unconnected or "high" to enable the APC220, and pulling it "low" will put the device to sleep. So I assumed that I can keep EN unconnected and everything should work? I tried also to connect it directly to VCC, also without luck. Do you mean that I should connect it through a 100 nF capacitor? Where should I connect the other capacitor's leg?
