Thursday, January 10, 2019

Light-Chasing Self-Driving Car (1): Parts

After nine months of weekly programming classes with my 4th-grade son, something that actually moves finally works.

A self-driving car that reads ambient brightness with light sensors and steers toward the brighter side.
I'll write this up gradually as a review of the curriculum we followed.

Build Plan

  1. Gather parts (this article)
  2. What is A/D conversion?
  3. Reading values from the converter via SPI
  4. Pseudo-analog output with Raspberry Pi PWM
  5. Motor control with a motor driver
  6. Connecting light sensor input to motor control

Parts List

Raspberry Pi de Manabu Denshi Kousa (Electronics with Raspberry Pi)

Amazon
The textbook for this series.
This book walks through building a smartphone-controlled RC car.
Along the way it covers A/D conversion and motor control — we referenced it whenever we got stuck.

Raspberry Pi 3 B+

Amazon
Raspberry Pi 2 or 3B also works.
Raspberry Pi Zero/Zero W is single-core — doesn't work.
Update: Raspberry Pi Zero W does work, but running VNC with a desktop while the camera is active gets quite sluggish.

Photoresistors × 2

Amazon
Photoresistors are light sensors — often included in electronics starter kits.
Two are needed, one for each side of the car, to compare left vs. right brightness.

A/D Converter: MCP3008

Amazon
An 8-channel, 10-bit A/D converter.
Note: it sometimes shows up on Amazon with absurdly inflated pricing (¥10,000+) — watch out for that.
Two channels are all that's actually needed, so any comparable chip will do.
If it's out of stock, try Akizuki Denshi.

HiLetgo L9110S Motor Driver

Amazon
Crudely built but extremely cheap motor driver.
Controls two motor channels with a single board, which keeps the overall build compact.

Double Gearbox

Amazon
Tamiya dual independent gearbox — motors included.
Versatile enough to build a lot of different things with this one kit.

Caterpillar Track Set

Amazon
Tamiya track and wheel set.
Easy to customize — adjust track length and wheel placement as needed.

Universal Plate Set

Amazon
Used as the chassis base.
Anything flat works — even a piece of scrap wood.

Other supplies: battery holder, portable battery pack, jumper wires (lots).



That's it for now — more when I get around to it.

No comments:

Post a Comment