Skip to content

Documentation for building an Arduino-based RC car for the purpose of demoing Cloud-connected capabilities and the source code for the program to run on it.

License

Notifications You must be signed in to change notification settings

disi33/CloudDemo_ArduinoCar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important note:

If you're running into the following error while compiling, refer to the section Notes on the implementation on how to resolve it:

lto1.exe: internal compiler error: in lto_output_varpool_node

Table of contents

Repository contents

This repository contains:

  • The source code of the program run on the car, written in the Arduino IDE
  • Schematics and reference pictures of the power-regulated WiFi module and the final build of the car
    • The schematics are made with fritzing. You can use fritzing to open the .fzz file and edit the schematics or use it to create a proper PCB.
  • A list of hardware and accessories used to finish this project

Hardware and accessories

Hardware

Accessories

  • soldering kit
  • AA batteries for the car and the XBOX 360 controller
  • USB Serial module for the ESP8266
  • tape for fixing the breadboard and the wireless controller adapter to the car
  • optional: rubber bands (the tires in some car kits do not create enough friction on most surfaces, you can put rubber bands around them to increase traction)

Modules

GPS Module

The GPS module is connected as follows:

GPS - Arduino
VCC <-> +5V
GND <-> GND
TxD <-> PIN 18 (A4)
RxD <-> PIN 19 (A5)

ESP8266 (WiFi module)

ATTENTION: The ESP8266 operates on 3.3V, while the Arduino operates on 5V! Do not connect the ESP8266 to 5V, use a step down regulator to convert the Voltage. The ESP8266 may not function correctly or even break/brick if operated under 5V. For the same reasons, use a 1k and a 2k resistor to step down the signal coming from the arduino on the ESP8266's RxD line!

The ESP8266 is generally connected as follows:

ESP8266 - Arduino
VCC <-> +3.3V (generated from step down regulator)
GND <-> GND
TxD <-> PIN 4
RxD <-> PIN 3 (through step down resistors)
CH_PD <-> +3.3V (through 10k pull-up resistor)

Notes on ESP8266:

When idle, the ESP8266 draws about 30-50 mA, but during peak load draws of about 300mA are not unseen. I recommend to use stabilizer capacitors of 470uF near the step down regulator and 0.22uF near the ESP8266 to help with sudden spikes. The capacitors should be as near as possible to their respective counterpart parts, since too much resistance on the cables running up to them can negate their intended functionality.

So all-in-all the ESP8266 requires quite a bit of extra work here:

  • step down power source voltage from 5V to 3.3V
  • add additional step down resistors for incoming signals from Arduino
  • a pull up resistor for CH_PD
  • stabilizing capacitors for smoother power supply during peak load times

The breadboard can be very restrictive in space and in how to place these components, so I recommend creating this circuit as a separate module on a prototype board. When doing so, please keep these things in mind:

  • You can solder a piece of a male connector row to the bottom of the connector board, that way you can put the module into the breadboard vertically.
  • Ensure the capacitors are placed close to the step down regulator and the ESP8266 respectively.
  • You can use 2 4-pieces of female connector rows as a base for the ESP8266 to sit in. That way you can easily remove it for programming purposes or replace it when broken.

Additional notes:

Most ESP8266 come pre-programmed to a baud rate of 115200. Arduinos regularly struggle to communicate at such a baud rate over Serial buses and it is recommended to user a lower baud rate. Use a USB interface to manually set the baud rate of the ESP8266 to 9600. (All source code distributed in this repo assumes a baud rate of 9600.)

A power supply of 6 AA-batteries should mostly be sufficient to operate the ESP8266 in addition to all other components on the car. That being said, I have experienced situation where the ESP8266 was suddenly becoming unresponsive. I suspect this is due to the power supply not being able to supply high enough current during peak workload, so I recommend not spamming the module with HTTP requests and limiting the use to 1 request every few seconds to minimize the need for resets.

Wireless XBOX 360 adapter

Use the USB shield to connect the USB adapter to the Arduino. You can run the cable underneath the base plate of the car and use tape to fix the cable and the receiver to the bottom of the plate.

Software

Use the Arduino IDE to upload the program onto the Arduino and to read the output on the Serial connection via the IDE's Serial Monitor.

Libraries

This project is using:

Enabling and disabling modules

The program consists of 3 basic modules that can be enabled and disabled before uploading the program to the Arduino:

  • Controller: for remote controlling the car using an XBOX 360 controller
  • GPS: for reading the car's GPS location
  • WiFi: for spinning up a HTTP server on the car to interact with it over WiFi

You can enable and disable these modules on top of the program file. When enabling the WiFi module, you must also specify the SSID and password of the WiFi network to connect to.

Notes on the implementation

  • Both the USB Host Shield library and the ESP8266_Simple library are using the SoftwareSerial library to communicate with their respective modules. Unfortunately, while SoftwareSerial allows for specifying several Serial connections on different pins, as of now this library only allows for only one Serial port to be operated at a time. Especially the ESP8266_Simple library seems to struggle to maintain its internal state when a different SoftwareSerial port is being operated. Enabling this functionality would require a complete overhaul of the used libraries. To work around this, for now the GPS data is only read from the GPS module once before the ESP8266_Simple Serial connection is established.
  • At the time of writing this, some of the used libraries are incompatible with the latest version of the Arduino AVR Boards board libraries used by the Arduino IDE. When running into issues while compiling or uploading the program, try downgrading the library version to version 1.6.20 in the IDE's board manager (Tools -> Board: "" -> Board Manager...).
  • The controller module allows for remote controlling the cars movement using the D-Pad. The current implementation is very basic and might occasionally drop an input, but should be sufficient for demo purposes.
  • The program is writing quite some information to the default Serial connection. You can use the Arduino IDE's Serial Monitor to debug the program if the car shows unexpected behavior. Note that the demo software used to display the car's IP address after establishing WiFi connection on the serial port, but due to some incompatibilities between the latest ESP8266 firmware and the latest Arduino libraries, we cannot easily do that right now. I recommend setting up the demo using a phone hotspot and reading the IP address from your phone as a fast way to get a connection and knowing the car's IP address.

About

Documentation for building an Arduino-based RC car for the purpose of demoing Cloud-connected capabilities and the source code for the program to run on it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages