Sticks, Threads and WIFI - RC Car
by Killmyfeel in Circuits > Remote Control
320 Views, 4 Favorites, 0 Comments
Sticks, Threads and WIFI - RC Car


During these New Year's holidays, I decided to please myself and my sons with a new toy - a radio-controlled car made from simple bamboo sticks.
It will be a car with an NodeMCU and Wi-Fi controlled.
Supplies

The project used:
- Wooden cubes: https://s.click.aliexpress.com/e/_DnKsPxX
- Wooden BBQ sticks (big and small): https://s.click.aliexpress.com/e/_DktJaNX
- Wooden sticks: https://s.click.aliexpress.com/e/_Dd1VcjL
- Stainless steel drinking straw: https://s.click.aliexpress.com/e/_Dl2X049
- Motor: https://s.click.aliexpress.com/e/_DCWP7hL
- Wheels: https://s.click.aliexpress.com/e/_DCWP7hL
- Servo Motor: https://s.click.aliexpress.com/e/_DD01uKD
- NodeMCU v3: https://s.click.aliexpress.com/e/_DCMk4hP
- Charger for 18650 battery: https://s.click.aliexpress.com/e/_DEzcGPF
- 18650 Li-ion batteries: https://s.click.aliexpress.com/e/_DEw7TsD
- Motor driver: https://s.click.aliexpress.com/e/_DEG1ACl
- mini Switch: https://s.click.aliexpress.com/e/_DFlOT1b
Rear Chassis
















Just look at the images :)
Car Body







Just look at the images :)
Electronic Circuit

Just look at the image :)
Rear Drive







Just look at the images :)
Coding


I used the RemoteXY service to generate code for Arduino. Settings in the photo.
The code here:
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "rc"
#define REMOTEXY_WIFI_PASSWORD "rc123456"
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = // 26 bytes
{ 255,2,0,0,0,19,0,16,24,0,4,176,25,28,79,9,2,26,4,48,
1,0,7,63,2,26 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
int8_t slider_1; // =-100..100 slider position turn
int8_t slider_2; // =-100..100 slider position go
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#include <Servo.h>
Servo myservo;
int motorrear = D2;
int motorback = D4;
void setup()
{
RemoteXY_Init ();
myservo.attach(16);
RemoteXY.slider_1 = 0;
RemoteXY.slider_2 = 0;
pinMode(motorrear, OUTPUT);
pinMode(motorback, OUTPUT);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay(), use instead RemoteXY_delay()
int ms = RemoteXY.slider_1*8+1500;
myservo.writeMicroseconds(ms);
int y = RemoteXY.slider_2;
if (y>100) y=100;
if (y<-100) y=-100;
if (y>0) {
analogWrite(motorrear, y*10);
digitalWrite(motorback, LOW);
}
else if (y<0) {
digitalWrite(motorrear, LOW);
analogWrite(motorback, (-y)*10);
}
else {
digitalWrite(motorrear, LOW);
digitalWrite(motorback, LOW);
}
}
Result and Test









This is all! Thank you for your attention.
Watch the video, everything is clear and simple :)