Wallrus: Electronics

Our control system uses a PIC18F2455 microcontroller to control two stepper motors and a pair of solenoids. For each motor, four digital output pins on the PIC are used to control each motor (two per stepper motor coil) - four PORTA pins are used to control the left motor, while four PORTB pins are used for the right motor. A forward rotation through the step pattern causes the motors to turn clockwise, while a backwards rotation causes the motors to turn counter-clockwise. Each stepper motor’s two coils must be able to be driven in both directions, so we use a pair of H-bridges using N-channel MOSFETs to control each motor.

H-bridge circuit diagram

Schematic of the H-bridge circuit for one coil of one motor, with MAX232 serial transceiver on high-side MOSFETs. Inverters are necessary because the MAX232 internally inverts the signal when it performs a TTL to RS-232 conversion.

The stepper motors we use run on 3.3 V. The IRF1104 MOSFETs we chose have a threshold voltage of 2–4 V; this plus 3.3 V is above the logic-level 5 V that comes directly from the PIC’s outputs, so we needed to boost the voltage to control the two high side MOSFETs. To accomplish that, we used the TTL to RS-232 voltage conversion functionality of the popular MAX232 serial transceiver chip. This is an unorthodox solution compared to using an external dedicated H-bridge driver, but it works quite well and is a good, simple design. The motors are controlled completely separately so that they can run at different speeds and in different directions than each other.

The PIC also controls the spray paint actuator through two relays, one for each solenoid. Two limit switches, one for each motor, is used to calibrate the system prior to drawing. This ensures that the computer knows the exact positions of the belts as well as acts as an emergency shut-off if the belt is about to run off the pulley.

The circuit is powered through a combination of USB and an old PC power supply. The PIC runs on 5 V, supplied over the through USB bus. Meanwhile, the motors run on the power supply’s 3.3 V bus, and the solenoids use its 12 V bus. We mounted the circuit on a breadboard with long cables linking to the motors, limit switches, and solenoids. We may eventually explore custom PCB fabrication, but at this point we appreciate the flexibility that solderless breadboard gives us.