/through-a-data-point

Code + doc for Data Through Design 2019

Primary LanguagePythonMIT LicenseMIT

through-a-data-point

Code + doc for Data Through Design 2019

HARDWARE

SETUP

Get the latest code

  • from the pi, run: wget http://enframed.net/deeds/controller.py

Video

  • following this
  • download the latest video by running wget http://enframed.net/deeds/legal_landscape.mp4 or wget http://enframed.net/deeds/legal_portrait.mp4

Wiring

The diagram for wiring a single motor can be found here.

Things to take into consideration:

  • The power source is represented as 2x AA Batteries. It should instead be the 12V power supply, connected to the power connector.
  • The wires coming out of the stepper motor are black and red. For clarity, I've connected them to wires that are the same as their actual color (red, green, yellow, blue).
    • This means that red and yellow go on one side of the IC, while green and blue should go on the other side.

Tip

Here's a shortcut to finding wire pairs for a bipolar (4 wire) motor. Spin your stepper motor with your fingers. Depending on the size / holding torque this could be easy or pretty hard. All you really want from this is to get a feel how the motor spins without any of the wires connected to each other. Now that you know how hard it is to spin with your fingers, connect 2 wires together, any two. Try to spin the motor again. If it feels the same then these are NOT connected to the same coil. Disconnect these wires. Connect one of the other wires to one of the first wire pairs you tried. Try to spin the motors again. This should be much harder. If so, you have found your wire pairs. Each pair goes on one side of the L293D.

Programming

In order to set up the raspberry pi, you will need to install it, find it, connect to it and execute the sample program.

  1. Download the disk image that we will flash on the SD card.
  2. Download Etcher.
  3. Insert the SD card in your computer.
  4. Open Etcher, select the image you just downloaded and the SD card you just inserted, and flash.
  5. Insert the microSD card in the raspberry pi and connect it to a power source. A microUSB plugged in to a laptop is enough.
  6. Once the raspberry pi is powered up, you should see a solid blinking LED.

How to find your IP Address

  1. On your computer, open the Command Prompt and type ping raspberrypi. The output should give you the IP address of the raspberry pi. Make sure you are on the same WiFi network as the raspberry Pi.
  2. Install Fing and scan your wifi network to find connected devices.
  3. Insert the SD Card into your computer. A boot disk should appear. Inside the boot partition, create a file called wpa_supplicant.conf, this is the file which connects automatically to WiFi networks. The file contents should look like this (make sure it's the correct ssid/pw for your own wifi!).
  4. Plug in the raspberry pi directly to your router. Then open the command prompt and type arp -a. Your raspberry pi is the device that starts with the MAC address b8:27:eb.

Connect and run the code

  1. Download Putty (you probably want the 64bit MSI version).
  2. Enter the IP address of the raspberry pi in the Host Name (or IP address) field, with Port set to 22 and click Open.
  3. A command prompt should open. When asked to login as, enter pi and for password enter raspberry.
  4. You are now connected to the raspberry pi. To execute the code to make the stepper motor turn, type python stepper.py and press ENTER. Follow the prompts on the screen to select the delays/numbers of rotations.