program help request

hello

I have the duemilnove , easy driver v3, longtech lcm2004d-nsw-bbw 20x4 character display , a electroswitch 91Q128-43 optical encoder and a gray-hill series 87 3x4 keyboard.

what i would like to learn to do is to connect all of these together basically i am a model railroader and i want to control the turntable on my layout.

Ok so for what i would like to do is have it on power up find a zero point and then the display and keyboard let me input what track number i want to go to and then move the stepper motor to that position, the display updating the track as it goes by till it reaches the track desired the stopping points will be equally spaced.

is this remotely possible? i have gotten my display to work and do the hello world though the first and third lines the second and fourth get used not sure how to fix that.

i have also gotten the stepper motor to work with with the unit i have no idea of how to get them both to work together.

I have not tried to get the encoder working or the key board.

i am not a programmer i can do hardware but programming is a mystery to me. Any help would be appreciated.

Thanks
Harry

i have also gotten the stepper motor to work with with the unit i have no idea of how to get them both to work together.

Both what?

In principle what you are suggesting sounds possible, but I'd be worried about how much power your stepper motor will have to move a "turntable". The Easy Driver is only rated for <750mA of current per phase which, for a stepper motor, might not translate to enough torque to move something "big".

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

i have gotten the display to work alone and the stepper motor to work alone. i think i want to start with those to get those two working together to show direction and number of steps to be moved and number left to move would be nice i think.

i will probably need some form of input to command the stepper to move.

i will probably need some form of input to command the stepper to move.

How about using the PC keyboard? Use the Serial class (see some of the tutorials/demos) to get characters from the keyboard and interpret them: 'f' for a forward step, 'b' for a backwards step, etc. You can then use the serial monitor window (or any terminal program) to communicate with your program.

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

well i dont have a ps2 keyboard and a 3x4 key pad is more then enough for what i want to do but i dont understand how to use multiple devises on the same pins. or is it even possible??

Harry,

When RuggedCircuits was talking about using the PC keyboard for input he meant:

  1. Connect your Arduino to a USB port on your PC.
  2. Run the Arduino IDE and bring up the serial monitor.
  3. Characters you type into the serial monitor on your PC can be read by the Arduino by using Serial.read().

Regards,

-Mike

mike thanks for that info but i must say i have no idea what you mean.

Harry,

OK, let's start from the beginning.

It sounds like you've been able to connect your Arduino to a USB port on your PC, run the Arduino software on your PC, write a program and send it to your Arduino. Is this correct?

-Mike

well not write a program but i have used the hello world to the display and been able to run the stepper motor program. to be honest i was super impressed i got that far

Harry,

That's good enough. Are you using version 0018 of the Arduino software on your PC?

-Mike

yes i am using the 18 version it is a slick interface.

one of the first questions i have is my display has a 20 x4 but if i put a message to the full four line the lines are interspersed i mean it goes line 1 then line 3 then line 2 and finally line 4. this is using the hello world but changing the message.

Harry,

After you run the Arduino software on your PC, you can bring up the serial monitor by clicking on the serial monitor button along the top of the window. If you put the mouse cursor over each button, it will show the button's function. Just keep checking buttons until you find the serial monitor button.

Once you have the serial monitor running, you can type characters into the box along the top and then press the SEND button. The character or characters you typed will be sent to your Arduino board over the USB connection. If your Arduino sends any characters back, they will appear in the large window on the serial monitor. Having your Arduino print out information at various points in the program is a vary powerful tool for testing and debugging your program.

On the Arduino side, you need to have a program that reads from the USB serial port by using the 'Serial' class. You can read all about Serial in the reference section on the web site.

That's how you can type in commands on your PC to control your Arduino.

Regards,

-Mike

lcds are strange. write each line separately.
each line shows 20 chars, but there are extra chars that are not shown, so you can't just write 1 long string.

You need a outline of tasks to get you to the endpoint.

  1. serial user interface. get an example where you type 1 char like 'a' at the pc serial monitor, and the arduino does something like print 'hello' on the lcd.

  2. Now take that knowledge, send 1-6 to set a variable and have the lcd print "New Track 1".

  3. Add the stepper motor control, so when you select track 1 it moves to something. add other track selections. In the sw you might map this to some sensor/switch table for tracking purposes.

  4. Add the sensor/switch feedback so the stepper knows where it stopped last. Passing/touching the correct sensor stops the stepper.

  5. Add the keypad as input, so now serial monitor is just for viewing the output(debugging). Keypad will input a value into 3-4 pins, detect this, decode the values for 1-6 etc,then send that selection to the same control function you are using for the serial input.

Maybe that helps.