Go Down

Topic: Need help with programing please? (Read 381 times) previous topic - next topic

slovw3

Feb 06, 2013, 06:57 pm Last Edit: Feb 06, 2013, 07:00 pm by slovw3 Reason: 1
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


HazardsMind

Have you tried a regular H-Bridge? Also you cannot have both USB and battery plugged into the arduino together.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

slovw3


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?

HazardsMind

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
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

UKHeliBob

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.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

slovw3


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  =(

HazardsMind

Start with the examples and maybe even a forum search, there is plenty of codes in here to help you get started.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

PeterH

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.
I only provide help via the forum - please do not contact me for private consultancy.

UKHeliBob


I dont even know how to write a program to do any of this, let alone soft start a motor, lol  =(

lol indeed.

A clearer circuit diagram would be a start.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up