Pages: [1]   Go Down
Author Topic: Need help with programing please?  (Read 339 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
   ( I have searched for a few days and tried to write a program but failed in both aspects.) with that said...
    I have a project that I need some help with. I have an arduino micro and I am completely new to programing and have no idea what i am doing
on the programing side of this project. What I would like to do is run a 12vDC motor bidirectionally for a set amount of time. and have it be triggered by a voltage signal (or ground???)  to the arduino micro. So when voltage is applied to (input pin) the motor spins cw for (time) then stops even though power (or ground???) is still applied to (input pin). When power is removed from (input pin) motor spins ccw for (time) then stops until power is applied again. If i can be steered in the right direction or if someone is nice enough to write the program i would be very thankful.
 
I attached a picture to show my setup/ or what i think is correct. im not sure completely as i am somewhat new to semiconductors

« Last Edit: February 06, 2013, 01:00:10 pm by slovw3 » Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3400
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried a regular H-Bridge? Also you cannot have both USB and battery plugged into the arduino together.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried a regular H-Bridge? Also you cannot have both USB and battery plugged into the arduino together.

 Sorry for my ignorance as i am totally new to programming and somewhat new to semiconductors. No i haven't, when you say regular h-bridge do you mean a semiconductor style? and i only would have the usb power to actually power the board the other power wire is the switched power to the pin, unless i can only have a switched ground?
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3400
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, an actual chip. Or if you have a few transistors lying around, you can make your own H bridge. Look up H-Bridge IC
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 108
Posts: 4018
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow - that diagram is confusing. Do you really have ground and 12 volts going to each motor terminal as it appears ?  I can't tell from the diagram which contacts on the relays are switching what.  Can you post a more conventional circuit diagram ?

As has been suggested an H bridge (Google for it) would be the normal way to control motors using an Arduino.  There is nothing wrong with using relays but they are on/off devices.  An H bridge (motor shield) would allow speed control of the motors which, is nothing else, allows you to soft start them which can be kinder than starting them at full power each time.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow - that diagram is confusing. Do you really have ground and 12 volts going to each motor terminal as it appears ?  I can't tell from the diagram which contacts on the relays are switching what.  Can you post a more conventional circuit diagram ?

As has been suggested an H bridge (Google for it) would be the normal way to control motors using an Arduino.  There is nothing wrong with using relays but they are on/off devices.  An H bridge (motor shield) would allow speed control of the motors which, is nothing else, allows you to soft start them which can be kinder than starting them at full power each time.

I dont even know how to write a program to do any of this, let alone soft start a motor, lol  smiley-cry
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 84
Posts: 3400
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Start with the examples and maybe even a forum search, there is plenty of codes in here to help you get started.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12534
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have a range of options available to you. A hardware based solution would need a couple of relays controlled by a couple of 555 timers, no electronics.

The easiest Arduino-based solution would use a UNO or similar with an H-bridge motor drive shield and a sketch that reads the input and turns the motor on forwards and backwards as required. Is your intended motor within the voltage and current capabilities of any of the commonly available motor shields? For example the L298N based shields supports voltages well in excess of 12V and will handle up to about 4A.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 108
Posts: 4018
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I dont even know how to write a program to do any of this, let alone soft start a motor, lol  smiley-cry
lol indeed.

A clearer circuit diagram would be a start.
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: