UniPolar Stepper Motor/ULN2003 Controller Optimized

This is the 2nd installment for the V3.01 Turret Grating Controller project for the 3D printable Raman spectrometer project.

Below is a link to the video @ my YouTube channel demonstrating the newest functionality and code changes.

UniPolar Stepper Motor Controller Optimized

I updated the code significantly, I added “ lcd.setCursor(12, 2); lcd.print(i–);” to the lines of code that control the motor coils so the current shaft position can be seen on the LCD display,

and incorporated a pin int sensorVal[] = { digitalRead [2][3] };//SW1 pin2 & SW2 pin3

This will illuminat LED’s #10(W) and LED #12(bl) to indicate that the switches

on HIGH. These values are then displayed on the LCD menu on line 3 as a monitor

of the switches values.

Note: You can see on the LCD screen that CW & CCW do not change, this is because the speed is way too high and the LCD cannot capture the characters fast enough…I think? Everything works fine when it runs at normal speed.

Turret Grating Control PIC JUNE16 PNG

Above is the circuit schematic featuring my design using an LM350T voltage regulator to supply 5vdc @ 0.600mA to the stepper motor.

This particular stepper motor is 5.625 degrees per step /64

Speed is controlled by a delay between each step.

The longer the delay the slower the rotation.

That delay value is obtained by reading the analog-to-digital

cover (A0 in this case/10K trimmer POT) which gives a value from 0 to 1023.

The value is divided by 4 and add 10 for a delay

in milliseconds:delay(analogRead(0)/4 +10)

For faster speeds change 10 to say 2.

This is calculated between every step to vary speed while stepping.

I am using a new 20 x 4 LCD display (yellow background) I bought from YourDuino.com, on the schematic I have a 200K trimmer POT, I was experimenting with different values and realized quickly that the source will become to weak for the ADC (internally), resulting in errors, and I’m not going to mess around with buffers and signal conditioning circuits. (Just UR typical 0.1uf CAP(+ end) & 10K resistor to GND @ each button)

So I dropped it back to the typical 10K POT, and it works just fine.

Some highlights of my code are:

1) NO debouncing programs

2) NO external Stepper libraries

3) Minimal stress imposed on the processor (in my opinion a faster response)

I designed the turret mount on FreeCad 0.16, and had it 3d printed @ Sculpteo using POM (powdered nylon material) cost of this part; $15.67 US. not too bad 🙂

assmbly PI2A

The updated code I am posting at my Arduino page here;


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s