Skip to content

maruel/bolide-esp8266

Repository files navigation

A 40$ wifi enabled race car 🚗

Idealized Actual
Bolide logo Bolide actual

No internet connectivity is needed, this isn't InternetOfShit.

Design

An ESP8266 connects to a MQTT server and waits for commands. It also runs a web server serving a MQTT client web UI (try it online!) that you can install as an App on your iOS or Android phone or tablet.

bolide-esp8266 uses the Homie MQTT convention so you can control it via any MQTT enabled automation service like Home Assistant, openHAB, or internet based services like IFTTT, if you really feel the urge to connect stuff to the internet. ¯\_(ツ)_/¯

Hardware

  • Car kit (20$USD) including motors but the ones with an Arduino Uno is unnecessary. You may buy one with a power converter and/or batteries and/or batteries holders already included.
  • WeMos D1 mini (4$USD) or any ESP8266 based board. One with a micro USB port is recommended.
  • L293D quadruple half-H driver (1.75$USD for 5pcs). Buy more than one, just in case you bend a pin.
  • Passive buzzer (0.50$USD) because it's more annoying when it beeps and we love annoying toys; optional.
  • LEDs (3$USD for 200pcs) for additional feedback; optional.
  • Resistor ~300Ohms for the LED (0.58$USD for 100pcs; 2.37$USD for 500pcs); optional.
  • 400 points Breadboard (1$USD) or 2x SYD-170 (0.38$USD each).
  • Breadboard wires (1.75$USD) or whatever wire you have around.
  • Screen terminal block (0.80USD for 10pcs).
  • Tactile button switch (2$USD for 100pcs, depends on size).
  • Computer to run Mosquitto; a Raspberry Pi or your workstation will do just fine.

BOM: 36$USD, including shipping, with a lot of left overs.

Power ⚡

The system runs at 2 or 3 different voltages:

  • The ESP8266 needs 3.3V and will burn if exposed at >=4V.
    • The WeMos D1 Mini already includes a 5V -> 3.3V DC-DC converter, which simplifies our life. If you use an ESP8266 which doesn't include this, you have to plan accordingly.
  • The L293D needs 4.5V~7V for its internal logic to operate.
  • The motors need 5V~12V. Higher voltage means a faster race car.

There's three options for motor voltage:

  1. Power the motors at 5V. It will move slowly but you can upgrade later.
  2. Use a DC-DC step down power converter (>=1A) (1$USD; 2$USD for 5pcs) and run the motors at high voltage then generate a 5V from it. You may want/need to add a capacitor accross the lines to stabilize the voltage.
  3. Use two different power sources, one 5V, one >5V. This has the side benefit of making voltage for the ESP8266 to be more stable.

There's many options for power sources:

  1. Wired 5V~12V wallwart (3$USD) and female adaptor (0.50$USD).
    • You may have one lying around from an old dead electronic device!
  2. AA batteries; 4x 1.5V (Alkaline) gives 6V, 6x 1.2V (Eneloop) gives 7.2V. AAA are likely not able to push enough Amps.
  3. 5V USB power bank (<2$USD). Even the cheapest colored round ones will be fine as the ESP8266 draws around 100mA. The cheapest ones won't be enough for the motor but high qualities ones (the ones rated for 2A) will be fine.
  4. 2x 3.7V LiPo batteries to give 7.4V:
  1. 2x 3.2V LiFePo4 batteries to give 6V:
  • Similar to LiPo batteries, but not suspectible to explosion. The 6V level is too high to power the WeMos without burning the RT9013 voltage regulator. They are available in both 14500 (AA format) and 18650, I recommend branded batteries.
  • I wouldn't be surprised if we see cellphones with LiFePo4 batteries in 2017. I said it here first! :)

Confused? 😕

Keep it simple and start with a USB power bank to power the WeMos and 4x AA Alkaline batteries to power the motors.

Be aware

  • Aliexpress searches are really hit-and-miss, it's possible it just decides to show you unrelated items depending on how it feels.
  • mAh values are generally overstated by the seller.
  • Shipping LiPo batteries cost more, so it may be simpler to source it locally.
  • You need a charger.

Wiring

Use the breadboard and the breadboard wires to connect everything:

Wiring schematics

Click on the image to edit the schema in EasyEAD!

Permanent soldering

Once you confirmed it to work, you may want to solder the L293D to reduce the overall size:

Software

  • Python 3.
  • PlatformIO (optional)
    • ./setup.sh installs a local version in virtualenv.
  • Mosquitto (optional)
    • Only needed if you setup Wifi on the WeMos and want to control the chair remotely or log operations.
    • sudo apt install mosquitto on Ubuntu or Debian.
    • Run the following to enable Websocket on port 9001 (adapt for other OSes):
      cat << 'EOF' | sudo tee /etc/mosquitto/conf.d/ws.conf
      listener 1883
      protocol mqtt
      
      listener 9001
      protocol websockets
      EOF
      sudo mosquitto_passwd /etc/mosquitto/passwd homie
      sudo systemctl restart mosquitto
      

⚠: anyone on the local network and see and inject commands. The ESP8266 is not powerful enough to do TLS/SSL reliably.

Flashing

  1. Connect the ESP8266 via USB.
  2. Copy config_sample.json to data/homie/config.json and edit as documented:
    • device name and id
    • Wifi SSID and password
    • MQTT server host name, port, user and password (optional)
    • Another option is to use the manual configuration mode but I don't recommend it.
  3. Run: ./flash_all.sh at a bash prompt.

The ESP8266 takes less than a second to boot.

Contributing

I gladly accept contributions via GitHub pull requests, as long as the author has signed the Google Contributor License.

Before we can use your code, you must sign the Google Individual Contributor License Agreement (CLA), which you can do online. The CLA is necessary mainly because you own the copyright to your changes, even after your contribution becomes part of our codebase, so we need your permission to use and distribute your code. We also need to be sure of various other things—for instance that you'll tell us if you know that your code infringes on other people's patents. You don't have to sign the CLA until after you've submitted your code for review and a member has approved it, but you must do it before we can put your code into our codebase. Before you start working on a larger contribution, you should get in touch with us first through the issue tracker with your idea so that we can help out and possibly guide you. Coordinating up front makes it much easier to avoid frustration later on.