Starting and stopping 2 DC motors with limit switches

I am BRAND NEW to arduino and am needing some help on a project I’m working on as I don’t have any experience with this yet. The project involves moves a shelf up and down and I need to use a set up with 1 led-push button, 2 DC motors and 2 micro switches. I am looking for ANY help in writing the code for the following and any help would be GREATLY appreciated!!!

So here is the situation I’m needing to make happen:

NOTE: the LED of the button needs to remain on even when the button and the motors aren’t in use. It’s a 6 pin momentary LED push button if that makes a difference.

  1. Press the push button once and two DC motors are powered on and begin moving the shelf upwards- one motor will need to spin clockwise, the other will need to spin counter clockwise.

  2. both motors are shut off/stop when a limit or micro switch is hit at the top of the track.

  3. both motors start out at full speed but then slow down as the shelf approaches the top of the track.

  4. press the push button a second time, and the motors reverse directions, thus pulling the shelf back down to the bottom- again I need it to start at full speed but then slow down as it approaches the bottom.

  5. second limit switch is at the bottom of the track and when that’s hit, the motors again shut off and movement and power to the motors stops.

Thanks in advance for any help on this!!

What help are you looking for? There is plenty of help already on this site in the many tutorials and in the answers to other questions. There are also lots of examples in the IDE, starting from the very simple for the complete beginner.

Please read How to get the best out of this forum

Thanks

Nobody is going to write your code or develop the circuitry for you unless you move your request to Collaborations and offer money.

However, if you make an effort, get stuck and ask for help, you'll get plenty.

To answer your question more fully: the right way to tackle this, if you've never worked with Arduino before, it to break the task into bite-sized chunks and work on each in turn. For example, read up on how to use a button to control the on-board LED. Then add some external LEDs. See if you can work out how to control the brightness of those LEDs. Then research how to control electric motors - speed and direction - and write a program that will turn a motor on and off, controlled by the button.

Then add the ability to control the speed of the motor. Then add direction control. Add another couple of switches which represent your limit switches, and get that working.

Another approach might be to leave the motor control until later in the process, and instead get the whole thing working with LEDs first. Then replace the external LEDs with motor drivers.

There's a lot to learn, but none of it is particularly difficult. The main thing is to make each step very easy by making it very small, and gradually working your way towards the final device.

I would strongly recommend you avoid finding some code on the Internet that is somewhere near what you want and start hacking at that. Too many times we see beginners doing that, with absolutely no idea what they are doing. The forum members end up having to debug some anonymous code that isn't quite what is wanted anyway, and the beginner learns almost nothing.

So, right now, all you need is some switches and some LEDs, and a willingness to experiment and do a bit of research. There are loads of examples in this forum, and on the Arduino site, that you can learn from.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.