AT the end -> A very trivial but important lesson – something that we all assume we know theoretically but might fail to implement practically !!.
- My first step was to test the module , the connections were straight forward and the results were good.
- After that i connected the pins from arduino to the level shifter like this –
|Arduino Pin||4-bit Level Shifter Pin|
There are two GND pins on the level shifter and both are internally connected so connecting one is enough.
- Then i connected the pins from the Level shifter to wires coming from the RC like this –
|Level shifter Pin||PCB wire|
- Final looks –
- After that i uploaded the codes –
Transmitter node takes analog inputs from the joystick. A lower threshold and an upper threshold is defined. So if the reading is between these two values then we transmit “3” , if it is less then we transmit “1” and if it is higher then we transmit “4”. Similarly the transmitted integers for the joystick that controls turning are “4” , “5” and “6”.
The receiver receives these messages and correspondingly decides what to do. It also serves an additional purpose of range finding. As soon as the receiver stops receiving data it glows a RED led otherwise it glows a BLUE led.
All the codes are here .
The output on the serial monitor was perfect. In the resting state of joysticks it showed that there is no turning and no movement and it responded correspondingly as i moved the joysticks.Then i connected the receiver to the wires from the PCB and powered the RC and the receiver. But the RC did not respond after i turned the joystick to and fro !!. I was very disappointed. My first thought was that the level shifters were not working. So i started checking the voltages at the outputs of the level shifter and i got my answer… it read 1.9V as opposed to 3.3V !!. I disconnected the level shifter from the RC and checked it again but this time it read 3.3V !!. I was now confused as well as disappointed. I connected it back and repeated the process and again it read 1.9 V and after disconnecting it read 3.3V !!. I stared at the setup for a while then i thought lets connect the GND of PCB to the GND pin of the Level shifter that was left.
After doing that as soon as i turned the joystick the RC worked like a charm !!.
Whenever you are connecting two or more circuits together into one big circuit, make sure that the Grounds are connected i.e the whole circuit MUST have a single Ground. In my case the level shifter and arduino had the same ground but the ground of PCB was different hence we were getting those strange readings. As soon as i connected the ground of the PCB to the Level shifter the whole circuit had on e ground and the RC started working.