Simple circuit to control a few relays

Thread Starter

PaulEscher

Joined May 30, 2011
17
I need help building a circuit.

I have an ACME threaded rod that is driving a nut about 16 inches using a 120v AC motor. There are DPST switches at both ends to stop the nut from going to far.

So I need to start the motor with the nut at the right switch, and have the nut travel to the left switch. At this point I want to wait a few seconds, heat a NiChrome wire for a few seconds, and then send the nut back to the right switch.

This process will happen over and over.

To start the process a push button or toggle switch would be fine.
I am okay with using relays to control the voltages to the motor and the NiChrome wire. I could use a timer circuit but the timings are not that critical.

If given the components and a hint on the right direction, I could probably figure it out.

Thanks,
Paul
 

#12

Joined Nov 30, 2010
18,224
Perhaps a third switch for the nichrome. Mount it so the nut turns it on an inch (or 2 or 3 inches) from the left stop and turns it off on the way back to the right stop switch. This depends on how fast the nut travels and if you MUST be stopped at the left end while heating the nichrome. This would act as a timer and thus simplify things.

If the nut is traveling at a high speed, this suggestion is useless and more information from you would be helpful.
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
So that would use a latching circuit to turn on with the first pass and off with the second? That would keep things simple.

I can power all of the circuitry with an old PC power supply so I have 5v and 12v available to me.

On second thought just keeping the NiChrome hot all of the time wouldn't hurt anything and would make it even more simple.

I'm winding a polyester ribbon fed by the threaded rod to another rod that is also turning (think of a coil winder, but single pass). I've got all of this working so far.

At the left end I need to cut the ribbon and then return the head back to the right side so the next ribbon rod can be loaded for another pass.

I'm still working on this and the forum is great for bouncing ideas back and forth.
Suggestions always welcome.

Paul
 

#12

Joined Nov 30, 2010
18,224
Not a latching circuit. I was thinking of a toggle switch with something flexible attached to the handle so the nut could flip the switch on as it goes by, and off as it goes by the other way.

Another way might be a microswitch with its actuator held up by a traveler that follows the nut and acts like a cam. But, if you can leave the heater on all the time, this idea is moot.

So where are you now in your progress?
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
Thanks for asking #12.

Right now I am controlling everything with a DPDT toggle switch. Each pole is inline with the opposite switch. So when you want it to go left, you push the toggle left and it will run until the left switch turns it off. Then you push the toggle switch right and it returns the nut (along the rod) to the right up until it hits the right switch which opens that circuit.

I really want this to be a push button operation. Speed is everything. As an aside, my wife can manually roll 10 rods every 4 minutes, and I have to beat that and make it easy enough to be run by my 9 year old. :)

I have the 120v motor speed controlled by a 120v Variac Transformer, and the contraption can handle about 48 volts AC, which runs the nut down the rod 16" in about 5 seconds, but add to that the cutting, loading and unloading it is at about 10 rods in 5 minutes... So I have my goal, 10 rods in less than 4 minutes. (Can't let the wife beat me.)

Eventually I would love to make a contraption that would auto load each rod, roll it, spit it out, and then roll another one. But one step at a time.

Any suggestions on getting the one button to work?
Considering that the nut is at rest on the right switch. Load the rod, push the button, have it run to the left until it hits the left switch, the NiChrome wire will auto-cut it, and then it will automatically return to the right swtich where it will wait.

I can post a pic or two if it helps.

Thanks,
Paul
 

#12

Joined Nov 30, 2010
18,224
This is not a 5 minute job. It involves a push button to start a "latching-on" relay circuit, a reversing relay for the motor, the limit switches control the reversing relay and de-energizing the latching-on relay. The latch-on relay energizes the NiChrome.

How far can you get with this much information?
 

#12

Joined Nov 30, 2010
18,224
Hotrod53F100 described a latching relay configuration. One pole of the relay supplies power to its own coil after you press the button. Another pole of the relay sends power to the rest of the circuit.

Later, a limit switch will open something in series with the coil of the latching relay to stop the cycle. If the limit switches are only closed for a moment when the nut hits the stop, you will need another latching relay to hold the reversing relay "on" until the other limit is hit by the nut.

The reversing relay is very much like the reversing switch you already made.

ps, this could be done in other ways. I am working with relays and switches because that's what you have to work with. Would you tear your hair out if I started talking about DC, steering diodes, and SCR's? Would you throw rocks at me if I started telling you how to program a microprocessor to do this?
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
I'll look at what Hotrod53F100 posted.
I am not against anything at this point. I have soldered simple circuits in the past and would open myself to doing it again. I am a programmer, not an electrical engineer, but anything is possible.

What are you proposing? Suggestions are what I am wanting.

Thanks for the interest!
Paul
 

#12

Joined Nov 30, 2010
18,224
I am proposing that you choose a general method...relays and switches, DC logic with discrete components, a microprocessor, digital gate logic...whatchoo best at? what do you have to work with?

ps, I need to go to sleep now. When the sun comes up, it will be Monday.
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
I suggest simple. I have Radio Shack as my quick source for components.

I can solder things as necessary. An IC and a few resistors and capacitors don't deter me. I have the relays, but can always convert to IR switches (I have a bunch after taking apart 5 printers and scanners.)

Yes it is late. I will sleep on it.

Thanks #12!

Paul
 

someonesdad

Joined Jul 7, 2009
1,583
Paul: if you're a programmer, then you should be able to write down a state machine diagram and a timing diagram for exactly what you want (i.e., this communicates your design). Then there will be a variety of technologies to choose from to accomplish your goal. Once those diagrams are nailed down, then post them here and you'll likely get different folks volunteering designs if you ask for them.

Personally, I'd recommend using a small microcontroller for the logic. A small 50 cent part like an 8-pin PIC could probably do the whole task for you:
Rich (BB code):
loop
    Monitor pushbutton switch to start sequence (and debounce switch).
    When switch is pressed, set one digital output line to ON (turns on motor relay).
    Start monitoring stop switch -- when it's activated, turn off motor relay.
    Turn on second motor relay to reverse motor.
    Monitor stop switch -- when switch is pressed, turn off second motor relay.
end loop
You can see this needs two digital output lines and three digital input lines. Those output lines would control the relays using e.g. MOSFETs or small 5 volt PC board relays.

If it was me, I'd use some of the 16F690 PIC chips I have laying around, as that would mean there are numerous pins available for expansion later. One of the basic rules of projects is that the rules will always change down the road. A microcontroller gives you the flexibility to handle design changes mostly in firmware.

Besides the μC chip, you'd need to make or buy something to program the chip. Personally, I'd recommend the PICkit2 or PICkit3, as I've used both and know they can do the job. You can download the needed tools (IDE, assembler, and C compiler) from the Microchip website; your application is simple enough to use the freebie tools. Other folks will recommend Atmel or Arduino -- it doesn't really matter, as they're all capable. Yes, you've got a learning curve, but you could probably have your application running in a couple of days of work. Then, once you've learned what's needed for this application, you'll have a whole set of new tools available to you for other tasks down the road.

If this approach interests you, respond and I'll recommend exactly what Microchip stuff to buy (a friend from across the country bought some of this stuff for a visit to us a couple of months ago and we basically did exactly this -- taught ourselves how to build things with PIC stuff).
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
Someonesdad:
I originally was looking at using a Phidgets USB stepper motor controller to run the axes. But I settled on using a standard DC motor and some switches.

After looking at a reversing relay circuit, it seems to be about as complicated as a programmable microchip, and I've always wanted to learn how to do this.

So I'll need a programming kit and a few chips. Should I get the Pickit 2 or 3, they are both around $60 and come with a 8/14 pin ZIF? http://stores.ebay.com/joshua1systems

Are these examples of the chips? PIC12F/PIC16F182X Microcontrollers http://ww1.microchip.com/downloads/en/DeviceDoc/41436a.pdf

BTW, you nailed the psuedo code perfectly.

Thanks,
Paul
 
Last edited:

#12

Joined Nov 30, 2010
18,224
Could I suggest monitoring the limit switches at all times?

As slow as this machine is, you probably have plenty of computing power to add some fail-safe features.
 

someonesdad

Joined Jul 7, 2009
1,583
#12's right -- I'd even add in a separate set of limit switches; I've see switches fail before.

If you want to go the PIC route, I would strongly recommend the PICkit 2 and the Low Parts Count Demo board. This came with the 16F690 chip, 4 LEDs, a switch and a pot along with the PICkit 2. As I recall, there were 12 lessons that take you through learning assembly language programming of the board demos. While I hate assembly because the code isn't portable, in this case it's worthwhile because it helps you learn the chip architecture. The lesson's documentations could stand a little improvement (I'd imagine it would be a bit challenging in places for newbies), but for an experienced programmer it was a piece of cake.

As I recall, it was $50. If you can afford $125 or so, I'd recommend the PICDEM Lab board, as it comes with a prototyping board and parts to help you build things. It's lessons are also a bit more polished and they let you work with a C compiler. It also came with a few different types of processors. For minimum cost, I'd recommend the LPCD board; for a useful tool, I'd recommend the PICDEM Lab. You'll have fun with either one and I guarantee at the end you'll say to yourself "Wow, that's pretty easy" and you'll be glad you have a new tool in your belt. Then you'll be walking around with a hammer and seeing nails everywhere. :p

Edit:

You can buy the stuff directly from Microchip (IIRC, my friend ordered a bunch of stuff; most of the kit stuff came from AZ and the chips themselves were shipped from Thailand).

You don't need a ZIF; just make sure you have a cheap IC extractor, although a small screwdriver works too. Just be careful inserting and removing from sockets; it's no big deal.

My friend purchased some extra microcontrollers -- I think he bought 5 of the 16F690 chips. This was a good choice, as they're 28 pin devices, so they can fit into two 14-pin DIP sockets (which I have a bunch of). Two pins need to be used for power and one for programming (IIRC), but most of the remaining pins can be used for digital I/O and analog inputs. This 28 pin chip then gives you quite a bit of freedom for lots of projects. There are a gazillion other chips to choose from too.

The beauty of the LPCD or PICDEM Lab with the PICkit 2 or 3 is that you are up and running (i.e., programming and watching things work) immediately after you've got the MPLAB stuff loaded in. While others talk about saving money by building things themselves, I'd be more than willing to spend that money to get up and running so quickly.
 
Last edited:

Thread Starter

PaulEscher

Joined May 30, 2011
17
1 PICDEM Lab Development Kit on its way. I should have it by Friday.

With two boys, 7 and 9, and their interest in inventing and robots, I am sure that we will get good reuse out of the kit. And what a great way to teach both programming and electronics! Two hobbies that I hope both pick up.

I pulled down the MPLab IDE and was going to run through their tutorials and simulators, that should at least get me ready to begin asking questions.

Thanks
 

someonesdad

Joined Jul 7, 2009
1,583
Excellent choice -- and your kids will have a blast. IIRC, that comes with the PICkit 2, which I found I much preferred over the PICkit 3, although the PICkit 3 can do ICE whereas you have to spend money to buy a header to debug the chips with the PICkit 2.

You'll find you made a good decision, as you'll be able to solve your problem and your kids will be having fun learning things and not knowing that it's actually "work". :p
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
Thanks someonesdad.

I'll be coming to you with a few questions, no doubt. But I'm excited to get started!

Thanks again,
Paul
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
Wow. I am loving my PICDEM lab. It is incredible what it will do for me. (I always hated making single use circuits, now I can reuse a lot!)

I'll post back my results once I get it working.

I'll post my PIC questions in a separate threads.

Thanks everyone!
 

Thread Starter

PaulEscher

Joined May 30, 2011
17
So far so good.

I'll have 2 relays and 2 switches. The switches will turn off the motor at the end of its run.

One relay will control 120v on and off, and the other will control the second relay which will flip the + and - to control the direction.

I got switches to turn LEDs on and off. (Not rocket science, but you gotta start easy and work up.)

I also built a circuit to manage the relays. A 470 resistor, a 2N3904, and a IN4001 diode (50V-1A). Works great.

So I think that I've got everything ready. Any suggestions?

while(1) {
if (RA1 == 0){ //left button pressed
set_motor_direction_left(); //flip relay 1
start_motor(); //flip relay 2
while(RA3 != 0); //wait for left switch
stop_motor(); //unflip relay 2
}
if (RA2 == 0){ //right button pressed
set_motor_direction_right(); //unflip relay 1
start_motor(); //flip relay 2
while(RA4 != 0); //wait for right switch
stop_motor(); //unflip relay 2
}
}

ps. Wife cancelled the idea of having a hot wire do the cutting. Too many fumes. She normally cuts outside with a full breather mask.

Thanks,
Paul
 
Top