Clicky

Player Piano

I wanted to try my hand at an HDL, so I decided to build a robot that can play simple songs on the piano. This project runs on the following hardware:

  • Gumstix overo
  • Altera Cyclone-II (Pluto-3)
  • 2 Stepper motors
  • 2 RC Servos
  • 4 l293b H-Bridges

The code for this project is hosted on github.

The idea here was to learn some VHDL, so I developed VHDL code (using quartus-II under linux) to drive both stepper motors, and servos. I created four 16bit registers in the FPGA which can be written from the gumstix overo ARM processor. Here is a high level over view of how the whole system works:

  • The ARM writes 8 gpios which are connected to input pins on the pluto-3 FPGA board.
  • The ARM then writes a “clock” gpio to cause the FPGA to latch the input pins.
  • Each register write is composed of the following three 8bit writes
    1. is the register address.
    2. is the low order byte of the data.
    3. is the high order byte of the data.
  • There are four registers, one for each stepper and servo.
  • Writes to a stepper register indicates how many steps to take relative to the current position.
  • Writes to a servo register indicates the pulse width to drive to the servo.

When it is all done the stepper motors will push or pull the servos down a small gantry system so that the servo can then strike the correct piano key.

The stepper motors are driven by the FPGA through the l293b H-Bridges from STMicroelectronics, the FPGA is setup so that four output pins are connected to the four H-Bridge input pins. Then the four H-Bridge output pins are connected to the stepper motors, I found that the steppers I have require about 1amp of current to run, and the H-Bridges are rated for 1amp max, so I used two H-Bridges hooked up in parallel to drive one stepper motor which effectively doubles the current the H-Bridges can handle.

I also wrote code to program the FPGA from the gumstix overo, this makes the system more user friendly because when the fpga is powered off it loses it’s configuration. There is a configurator/boot prom on the fpga board, but I didn’t want to overwrite the default configuration so I decided to write my own programming code instead.

Videos:

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*