The Design


Here is the overall idea:
Imaging you have a toy car, which is only capable of rolling back and forth. Then you want to fancy it up and add some steering system on it. Now it can move back and forth, turn left and right. Then you want to control it because it was getting fun. Then you add a control system. And then you are having so much fun now. So you want to add a remote control system. And that how an RC car is born.

Since I have a background in EE and CSC lets talk about the control system first.
The project needs to have two boards. One on the controller and one on the receiver. Now a day, on the modern RC you will have an ESC which controls the motor, and a receiver that talks to the ESC. So the ESC acts like a translator to "translate" digital signals to analog signals. With my design, the ESC and the receiver are combined. The idea is that the receiver listen to incoming signals from the transmitter and then sends out appropriate commands to control actuator devices (Servo, Motor, and LED).

Lets talk about the Receiver circuit:
The heart of my receiver is a micro-controller. I use Arduino nano because it is my favorite in term of size. There are of course more powerful micro-controllers out there like the ARM-Cortex and you are free to choose whichever you are comfortable with. Oh you can definitely use the Raspberry Pi for this as well. Anyways, the Nano board listen to signals. To be specific, I transmit those signals using an array of integers (If you are not sure what the means you can just copy and paste my code) from an array of 4 elements. I'm only using 1 channel on my transceiver because it is more than enough. I think the NRF24 supports multiple channels, if you want to go for heavier loads like maybe transmitting live images than multiple channels is a good idea. Anyway, the first index in my array
dataReceived[0] is a variable that ranges from 0-1023 (as the result of a 8-bit ADC). I use that to control the servo. I mapped those values to 0-3 by multiplying 3 and divide by 1023. So in my code you may find a line that says dataReceived[0] = analogRead(...)*3/1023;
Then you can you those values to control your servo like this: 0 means left, 1 and 2 means neutral and 3 means right.
The Servo library allows you to write a certain angle to the servo so you can write 90degree when received a 0, 0degree when received a 1 or 2, 180 degree when received a 3. Now, you might be thinking why didn't I just map the whole thing (0-1023) to 0-180 degrees so that you can fine turn the servo. Trust me I tried it did not work. I did not want to dive in to it yet.
Similarly the second index from my array controls the motor. The motor has a little more functionalities due to different speeds. So you can do backward, backwardMaxSpeed, Neutral, Forward, ForwardMaxspeed.
Same idea for the LED. But instead of reading digitized analog values you can just read digital value (HIGH or LOW) from a switch because you just want to turn it on or off.

Lets talk about Transmitter Circuit.
What goes on the transmitter includes a Nano board, NRF24L01 transceiver, 2 thumb sticks, 3 switches and an OLED display. Here is how it works.
The Nano boards reads analog/digital signals from the joysticks and switches and then places them into an array. Then it sends those information to the transceiver to send out. Now the transceiver is capable of reading information as well since this is a 2 way communication. So it reads back data from the receiver to display on the OLED. What the data is is up to you. In my case, I display the battery status of my receiver board.
That's the idea for the electronics, you can find the parts on my "The Hardware section".

No comments:

Post a Comment