Tutorials: Electronics fundamentals (ELEFU)

The rover

last updated: 2021-09-12

Quick links

Introduction

To work, we need hardware :), so each student builds his own rover. The rover is WLAN controlled by a computer or phone. We will use the rover or parts of it in our experiments and "just do it" exercises.

rover handy

Bill of materials (BOM)

Mechanics

Most parts have to be mounted in the right direction. It is frustrating to unmount parts that are not mounted the right way, so stay concentrated and look twice at the pictures.

bom

motor mount

wheel mount frontwheel

battery holder battery holder bottom

PCB assembling and soldering

How to solder

There are many sites and videos on the net, so I will not reinvent the wheel. Here is a link, explaining soldering: https://www.sciencebuddies.org/science-fair-projects/references/how-to-solder Read the 6 Tabs carefully an then just do it :). Exercise is the best teacher.

Respect the following seven points:

  1. Clean always your tip of the soldering iron by wiping on a damp sponge or cleaning wool.
  2. Your PCB has to be free from dirt.
  3. Heat the connection (copper pad and lead from the component) with the tip of the iron for a few seconds before! applying the solder wire (a big pad e.g. GND plane needs more time to heat up!)
  4. Keep the iron tip on the connection as the solder is applied and use just enough solder to form good connection (see images on link above).
  5. Remove the tip from the connection as soon as the solder has flowed. Remove first the solder and then the iron. The whole process should take just a few seconds, so don't overheat the connection.
  6. Don't move the connection while the solder is cooling!
  7. Inspect the joint closely and if the connection looks bad, reheat it and try again.

Soldering

pcb pcb populated

mhetlive 1 mhetlive 2

Connecting the motors

motorsoldering motorwiring

motor wires motor wires with tube

Connecting the battery holder and the switch

Programming the ESP32 with Arduino

Installing Arduino

Download the latest Arduino software from Arduino.cc and extract the compressed folder. You can do this on a USB Stick. Now switch to the Arduino folder and create a folder with the name portable inside the Arduino folder. A portable installation allows to carry around your personal set of sketches, cores and libraries, to be used on any computer without affecting it with your files (see here).

To be able to use Arduino with ESP32 we add the ESP32 framework simply by adding a text line to to "File > Preferences > Additional Boards Manager URLs:". Enter the string

https://dl.espressif.com/dl/package_esp32_dev_index.json

into Additional Board Manager URLs: field. You can add multiple URLs, separating them with commas. So we also add the string:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

to be able to use ESP8266 devices. Now open Boards Manager from Tools > Board: > Boards Manager..., scroll down and install ESP32 and ESP8266 platform.

To use later Teensy Boards we download Teensyduino from the pjrc homepage and follow the instructions on this page to install it..

After the installation we select our ESP32 board MH ET LIVE ESP32MiniKit from Tools > Board) and choose the right port under Port.

Programming the ESP32

Download the following .zip-file and unzip it in your sketchbook folder:

In Arduino the C or C++ code files are named "sketch" have the extension .ino and must be contained in a folder with the same name (without .ino). In the same folder we have also the html page.

Download and uncompress the file rover_snyder1_both_esp_websockets.zip to your portable/sketchbook folder. Open the file (File > Sketchbook > rover_snyder1_both_esp_websockets).

The Arduino library Websockets from Markus Sattler has to be installed (Tools > Manage libraries... > search for websockets and scroll :)).

Change your SSID and Password in the sketch:

    const char *WIFI_SSID = "btsiot01";     // AP settings
    const char *WIFI_PASSWORD = "btsiot01"; // password must have min. 8 char.!!

Now we click on the Arduino Upload button arrow to the right to compile and upload our sketch.

Finish an first test

First Test

rover url

rover sliders

Circuits

The basic circuit is prepared to use two IR encoder and an I²C acceleration sensor.

circuit


Optional circuits

Here are two optional circuits.

The first option is to add a relay and switch off the batteries after a certain amount of inactivity. For this we replace the original switch with a push-button.

The second optional circuit measures the battery voltage and current and sends the values over Serial or UDP.

They are possible because the ESP32 has more pins than an ESP8266. The relay is switched with GPIO33. Analog inputs are on GPIO34 and GPIO35.

circuit options


rover options 1 rover options 2


You can activate the options in the software by uncommenting the corresponding line:

    #ifndef ESP8266
      //#define RELAY            // uncomment if you use a relay (only ESP32)
      //#define MEASURE          // uncomment if you use measure current (only ESP32)
    #endif // ifndef ESP8266

Downloads

Interesting links