Duplex-sychronous communication between two arduinos

Hey everybody,
i am a noobie in arduino world but i know how to programm at all! Nowdays i am working in a project. This project is an RC Car with force feedback via arduino. What i want to do is to drive the rc car with a steering wheel and the car send me back the position of the steering wheel and the data from one 3-axis accelometer. My setup until now is an force feedback steering wheel and an arduino mega 2650 to read the potentiometers of gas,brake and steering. I send data with an NRF24lo1 to an arduino uno attaached on the car and another NRF24 on it. Until now i managed to control the car but dont how to send back from the car to steering wheel the analog input of servo and from the 3-axis accelometer .
Can anyone help to achieve a live communication between the 2 arduinos ??
If helps i can upload the two nodes of code ( one in transmitter and one in receiver)

No one ? :frowning:

I only need to know how to achieve the two way communication!

No one ? :frowning:

I only need to know how to achieve the two way communication!

You already said you have comms between the arduinos with a NRF24L01? What else do you need?

If you are asking how to incorporate accelerometer report into your control system?

  1. what Accelerometer are you using
  2. What type of user controls do you have that have a force feed back mechanics?


Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.

Hello chuck
first of all i appreciate your willingless to help me. So far i have achieved ONE way communication between the two arduino, like simple transmiter - receiver. I can control the servo by rotating the steering wheel ( potentiometer -serial data) and the esc and motor ( by pressing gas pedal ( potentiometer -serial data). But i want to achieve TWO way communication. More specifically i have a feedback servo that have one extra wire that is from the internal potentiometer so as to have data about the position any time and i want to send these data (serial) from the arduino attached on the car to the arduino on the steering wheel so as to control the force feedback motor. Also i will attach on the car an accelometer and i want to send to the data to the arduino on steering wheel so as to control two dc vibration motors so as to vibrate when the car for example jumps.

So now i send data from the one arduino to the other but i want the other arduino send some data back !

I will attach some photos of my setup!

the steering wheel

the feedback motor and the l293d motor control

ok Dermatis,

Now I need to know what radio (hardware and software library) you are usings. Most NRF24l01 libraries are packet based. You create a packet (with sender and receiver node address and data) hand it off to the Library and the library+NRF24l01 passes the data. You get a ACK or NAK based upon success or failure.

Since you are already sending in one direction it should not be too hard to send a packet the other way. the radios are already passing messages back and forth. (for the ACK)

Attach your working code to your reply, so I can understand it and suggest modifications.

What is the accelerometer you are going to use. I assume you want to apply the lateral accelerations as PWM against the steering wheel.

How is the L293d wired to the Arduino? What are the pin assignments?


Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.

Again thank you a lot!

Here is code of the receiver and transmiter.
In the ino files you will see the libraries and the pin assigments of nrf24.
These nodes are only to control the car.

printf.h (657 Bytes)

Rx_Baord_2_0.ino (1.88 KB)

printf.h (657 Bytes)

Tx_Board_2_0.ino (2.09 KB)

Here is the code i made at first to set up the steering wheel motor with the l293d
The l293d i use it to control the motor of the feedback and the two dc vibrating motors .
Its very simple because it is only to test the functions. I will write this node into the transmiters node.

My accelometer (ADXL335 3-axis Analog Output Accelerometer Module) will send data only to the vibration motors ( may i will use only z-axis )
The potentiometer into the servo i will use it as PWM against the steering wheel.
But i will test it in action and i may change some things!


AnalogReadSerial1.ino (1.99 KB)

No one to help me :o

No one to help me :o

It appears to be a complex project. What has worked so far what has not worked? You may need to break your project into individual components to identify any issues.

No one to help me :o


I looked at your files?

What is the schematic of the systems?

You may understand the relationship between The Accel, Vibration Motor, feedback motor, and Arduino Pins, but I don't.

In your AnalogReadSerial1.ino, What is connected to Gas, Brake, Steering? How is the L293d wired, What is it driving?

What is it not doing that you want?

Start Simple.

Are you getting readings from the Accel?

Can you control the Feedback motor?

Can you control the vibration motor?

Can you control the steering?

Can you control the speed control?

Can you send data from the Master( joystick, steering wheel) to the Slave(car)?

I need example of what is not occuring. I do not have your hardware. I might be able to wire up a couple of NRf24L01's, but I don't have your feedback systems or controls.


Thanks for your willing to help me ! Tonight i will try some updates that i made.
Then i will write a comprehensive and analytical post so as to let you understand completely what i made and what i want to achieve!

Thanks in advance

I made some updates so now i am ready to write down and le t you understand what i want to do.

On the car :
i) Controlling the car

NRF24lo1 module ( Gnd ->Gnd,Vcc->3.3V,CE->9,CSN->10,SCK->13,MOSI->11,MISO->12)
Servo ( Vcc->5v,Gnd->Gnd,Sgn->3)
ESC ( Gnd->Gnd, Sgn->6)
Motor connected to esc

ii) Feedback from the car

Accelometer (Gnd->Gnd,Vcc->5V, Xout->A1,Yout->A2,Zout->A3) i am not sure if i will use all the 3 axis
Internal potentiometer of the servo ( Pot->A0, Gnd and Vcc connected before)

printf.h (657 Bytes)

Rx_Baord_2_0.ino (2.11 KB)

On the steering wheel:
i) Controlling the car

NRF24lo1 module ( Gnd ->Gnd,Vcc->3.3V,CE->9,CSN->10,SCK->13,MOSI->11,MISO->12)
Gas potentiometer (Gnd->Gnd,Vcc->5V, Center pin->A1)
Steering potentiometer (Gnd->Gnd,Vcc->5V,Center pin->A0)

ii) Force Feedback
To have feedback on the steering wheel i need the serial data that i read on the (ii) part on the
arduino on the car ( Servo pot and accelometer). I want to receive these data to the arduino on the steering wheel. On the steering wheel there is a feedback motor that simulates the force on the wheels and is controlled with a custom motor driver ( l293d). Also there is an vibration motor also controlled by the same motor driver ( l293d can drive 2 motors)

L293D connection:
enable 1,2-> 5V
input 1->arduino mega digital 22
output 1-> force motor + pin
output 2-> force motor - pin
input 2-> arduino mega digital 24
Vcc 2 → 12V
Vcc 1->5V
input 4 → arduino mega digital 26
output 4->vibration motor +pin
output 3->vibration motor - pin
input 3-> arduino mega digital 28
enable 3,4 → 5V

printf.h (657 Bytes)

Tx_Board_2_0.ino (2.19 KB)

pins diagram l293d.jpg

So what i already made and works is the the part (i) from both posts and what i want to achieve is to the send the data of part ii of the receiver to the arduino on the steering wheel!

I tried the feedback section non wirelless with the code AnalogReadSerial1 that posted in a previous post!

So do you have any idea?