Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Very, very new to this... need advice

Status
Not open for further replies.

testhead1313

New Member
Hello all,
I must preface this by saying I know absolutely nothing about microcontrollers, circuit design, and only a limited amount of programming, so please bear with me...

I am in the process of building a switching device for a project I am working on and need a way to switch the polarity of an electromagnet. I am looking for a device (I'm assuming a microcontroller) that will allow me to control the polarity of the EM; the polarity can be switched by switching the current flowing through the EM. First off, does anyone know of a switch that can control control the polarity? I am also looking to program a device to do simple (for now) patterns and also random patterns. By simple, I mean 30 seconds (+) polarity, 30 seconds (-) polarity, repeating, etc. By random, I mean changing polarity at no less than 30 seconds, no more than 5 minutes. I know the programming will be very simple, but I don't know what kind of hardware I need to accomplish this. It needs to be something that I can interface with a computer to change these programs if need be. Thank you for your patience and suggestions! Mods, please move this if it's in the wrong place.

Chris
 
testhead1313 said:
Hello all,
I must preface this by saying I know absolutely nothing about microcontrollers, circuit design, and only a limited amount of programming, so please bear with me...

I am in the process of building a switching device for a project I am working on and need a way to switch the polarity of an electromagnet. I am looking for a device (I'm assuming a microcontroller) that will allow me to control the polarity of the EM; the polarity can be switched by switching the current flowing through the EM. First off, does anyone know of a switch that can control control the polarity? I am also looking to program a device to do simple (for now) patterns and also random patterns. By simple, I mean 30 seconds (+) polarity, 30 seconds (-) polarity, repeating, etc. By random, I mean changing polarity at no less than 30 seconds, no more than 5 minutes. I know the programming will be very simple, but I don't know what kind of hardware I need to accomplish this. It needs to be something that I can interface with a computer to change these programs if need be. Thank you for your patience and suggestions! Mods, please move this if it's in the wrong place.

As the question isn't really micro specific, it's fine here. There are basically two ways to do it, use either a relay (DPDT), or an H-Bridge. The relay is far simpler though!.

Or if you don't mind using two power rails, you could use an SPDT relay, or half an H-Bridge.
 
Nigel Goodwin said:
As the question isn't really micro specific, it's fine here. There are basically two ways to do it, use either a relay (DPDT), or an H-Bridge. The relay is far simpler though!.

Or if you don't mind using two power rails, you could use an SPDT relay, or half an H-Bridge.

Let me do some googling, and I'll get back to you. I assume you're referring to the switch itself, correct? Thanks for the response!
Chris
 
testhead1313 said:
Nigel Goodwin said:
As the question isn't really micro specific, it's fine here. There are basically two ways to do it, use either a relay (DPDT), or an H-Bridge. The relay is far simpler though!.

Or if you don't mind using two power rails, you could use an SPDT relay, or half an H-Bridge.

Let me do some googling, and I'll get back to you. I assume you're referring to the switch itself, correct? Thanks for the response!
Chris

Yes, the switch itself - for a relay version you just need the relay, a driver transistor, diode and resistor, fed from a PIC - a VERY simple circuit, and a relay is plenty fast enough for your very slow switching requirement.
 
Okay, so a DPDT relay makes a ton of sense now! So simple, I can't believe I didn't think of it earlier... Now onto the controller...
 
Just to be sure, for a stand alone device, I would need something like this, correct? (Image taken from Ebay - I was reading your tutorial and pulled a pic of a 16F628A - is this overboard for what I need?):
**broken link removed**
This unit, however, is powered by the USB connection. I would rather have the interface as USB, and use an AC adapter. Is this possible? Can anyone point me in the right direction? Thanks again!

EDIT: So I read through the whole Ebay post and realized that this is a PIC programmer. I that case, I would need something like this to program the PIC with the programs I planned on, right? So then (really dumb question coming up), how do I wire the PIC into the circuit? When the PIC is wired, the program will then just continually cycle?
Chris
 
Okay, I'm going to do some serious reading. This stuff is intense! My girlfriend will kill me if I pick up another hobby, but my mind is already churning over all the crazy gadgets I could make. I'm sure I'll be back with more questions in a bit. Thanks for your patience with my questions and ramblings!
Chris
 
testhead1313 said:
Hello all,
I am in the process of building a switching device for a project I am working on and need a way to switch the polarity of an electromagnet.
The most ridiculously simple way to do it is to use a DPDT switch and flick the switch when you want to switch the polarity. The above posters have also recommended using DPDT relays. I haven't used a relay yet, but I would think it is almost the same as an ordinary DPDT switch.

I am looking for a device (I'm assuming a microcontroller) that will allow me to control the polarity of the EM; the polarity can be switched by switching the current flowing through the EM. First off, does anyone know of a switch that can control control the polarity?
I think an H-bridge arrangement is better than a relay, because the switching speed can be faster, and the relay is a mechanical device which could break down eventually (because of misuse, or wrong connection, etc.).


I am also looking to program a device to do simple (for now) patterns and also random patterns.
Since you are new, you will need to learn how to write a program on a computer. Once you have done that, you will then need to find the instruction set that is compatible with the microcontroller you use. Next, you need to make a program using the instruction set. When everything works, the CPU processes the byte codes for each instruction.

I know the programming will be very simple, but I don't know what kind of hardware I need to accomplish this. It needs to be something that I can interface with a computer to change these programs if need be.
You have a couple of options. You can use a microcontroller, where a CPU and code ROM are built in. the AT89C2051 is good, and I bet Nigel will also recommend a PIC microcontroller as well. The other option is to get a rom chip, maybe some ram, and a CPU. The rom chip will contain the code, and the CPU processes it.
 
Thanks for the response mstechca! I'm going to do some reading over the next few days and debate the DPDT relay and the H-bridge. A simple DPDT switch wouldn't work as it needs to be fully automated. I know the basics of BASIC and C++, so I'm not terribly worried about the programming part. Stay tuned and thanks again!
Chris
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top