I'm starting a little project that will run a square wave through a copper coil to make magnetic pulses. I imagine the project would be quite straight forward if I were a little more experienced with making electronics.

The exact specifications of the coil and magnetic pulses are essentially not that important. I don't want to go into too many details about why, but suffice it to say the device should "work", i.e. it should generate magnetic pulses that are easily detectable with, say, a steel washer. The frequency range I'm targeting is about 50-120Hz which I'll generate with the PWM module in the PIC.

Here is what I have so far:

I'll use a 2155 type 1A xformer, and I'll be using the 6.3 and 15V taps.

I'll use the 6.3V to drive a 5V VR to power a PIC16F877A (I think those are the ones I alread have lying around). The PIC will use a potentiometer set up as a voltage divider on an analog pin to control the frequency between a given range (I've never done any analog or ADC stuff before). The PIC will also drive a small 8-segment display to show the frequency, and I'll use a crystal oscillator to give the PIC a more stable clock (I've had issues with timing in PICs before). The square wave will be between 0 and 5V.

For the coil, I basically want as much as possible, so I'll use the 15V to drive a 12V VR. I'll use the square wave output of the PIC (positive only) as a 5V input to an OpAmp. 5V -> 12V is a gain of 2.4, so I'll use a 240K and 100K resistor for the feedback of the OpAmp (I've also never used an OpAmp before either). I'll also use a schotky diode, reversed, to prevent the collapsing field to burn anything out.

I hope that all makes sense and sounds more-or-less reasonable. I know I don't need to use a PIC, but I've used them before and they're easy to program use, and I'm a lot less confident doing analog frequency adjustment with, say, a 555 (also never used these before either, lol), and using an 8-segment driver. I just want something that works and that's within my capabilities.

Here are some parts I have so far: (I'll be using 240V mains)

  • 2155 type 1A transformer with 6.3, 7.5, 8.5, 9.5, 12.6, and 15V taps.
  • 7805T 5V regulator
  • 7812T 12V regulator
  • BR104 10A 400V rectifier x2 (one for the 6.3 and one for the 15V)
  • 8Mhz crystal for the PIC
  • 1K linear VCU pot
  • SB560 schottky diode 60V 5A
  • 0.5mm 500g enamelled copper wire (approx 180m length)

I'll also have some electrolytic caps before and ceramic caps after the rectifiers in the power supply sections. I've got a bunch of these lying around in my drawer already.

I have a few questions:

  • If I've said anything absurd so far, please point it out.
  • Let me know if any of these components seem wildly overkill, e.g. the schottky diode or rectifier, for example.
  • I'm not sure if I even need a voltage regulator for the high(er) voltage section. If I can avoid it and just use bigger caps, I can drive the coil at 15V which would be "better".
  • I have no idea what OpAmp to get. I'm looking at the LM301AN which seems reasonable.
  • I'll wrap the coil reasonably tight. It's ~180m and I aim to have it in a small package around 4x4x2cm approx. I don't know how many turns this will be, but probably "a lot". I can only assume that driving a 0.5mm copper coil at 15V @ 120hz should be fine? (i.e. won't burn out)

Sorry for being so vague. If you comment with a question I can actually answer, I'll do so.

Thanks for your help.

If I get some things clarified here, I'll order the parts online and post a circuit diagram in the next few days, and then we can all laugh together at how bad it is.


2 Answers 2


The coil, it seems, is not well-defined and my first thought is that an op-amp won't cut the mustard on driving it successfully. The LM301 is only really suitable for driving kohm loads so I believe you ought to invest in a power transistor to interface the op-amp to the solenoid/coil.

But hold-on, lose the op-amp and use a logic level mosfet driven from the PIC'c PWM output. Connect source to 0V, gate to the PIC output and put the coil between drain and positive supply. This will give you a better drive to the coil and don't forget to put the diode across the coil reverse biased to catch the back emfs when the transistor is turned off: -

enter image description here

The 100k resistor is to ensure the mosfet remains off when the input is not connected to anything (important). The 1k is to limit stress on the PIC output because the MOSFET will likely have input capacitance in the order of 1nF. You need to find a MOSFET that will switch fully on with the positive drive level from the PIC (5V presumably).

  • \$\begingroup\$ Thank you. Yes, the PIC should be outputting either 0V or 5V at any given time. \$\endgroup\$
    – Ozzah
    Commented Jul 24, 2015 at 11:39
  • \$\begingroup\$ Would it be better to put that 100K the other side of the 1K? \$\endgroup\$ Commented Jul 24, 2015 at 12:05
  • \$\begingroup\$ @RogerRowland technically, to get a slightly higher voltage drive to the gate, yes. \$\endgroup\$
    – Andy aka
    Commented Jul 24, 2015 at 12:55
  • \$\begingroup\$ Do you think a FQP30N06L (60V logic N-channel MOSFET) will work well here? \$\endgroup\$
    – Ozzah
    Commented Jul 24, 2015 at 14:33
  • \$\begingroup\$ The graph to study in the data sheet is figure 1 - it tells you that for a 5V gate-source voltage, if you want to pass ten amps, the volt drop across drain to source will typically be about 0.3 volts. Is this good enough? I've seen better but it might suit your circuit. You might consider what the mx voltage can be that the drain sees - it'll never see more than 20V so go for a 30V rated device - you'll get better on resistance (if required). \$\endgroup\$
    – Andy aka
    Commented Jul 25, 2015 at 10:19

1) I recommend using the 7.5 volt tap for your 5 volt section. Looking at the peak voltage from 6.3 volts (8.8) and subtracting two diode drops (1.5 volts) in the rectifier leaves 7.3 volts at the regulator. With an output of 5 volts, this only leaves 2.3 volts across the regulator. With some regulators this would be just fine, but it's iffy for a 7805.

2) Make sure you put at least a 1000 uF cap on the output of both rectifiers. In fact, it won't hurt to use more on your 15 volt tap.

3) Yes, using a 400V rectifier in your case is wildly overrating it, but it doesn't save much money to go with a lower voltage, so if you already have them, use them.

4) .5 mm wire has a resistance of about 36 ohm/km, so 180 m will only have about 6.5 ohms resistance. Worst case, this will require about 2.5 amps at 15 volts, so you should either get a bigger transformer or use thinner wire. It's true that you will be driving this AC, which will reduce current flow, but without knowing the final inductance of your coil it is difficult to know it this will be sufficient. "The exact specifications of the coil is not important" is wrong.

But let's say that your 4 x 4 x 2 cm is 4 cm in diameter with a length of 2 cm, and a core dimension of 1 cm in diameter. Then the coil cross-sectional area is 1.5 cm x 2 cm, or 300 sq mm. Then .5 mm wire can only fit 600 turns. Assuming an average turn diameter of 3 cm gives a maximum wire length of about 56 m, so I don't see how you're going to get what you want.

This http://www.66pacific.com/calculators/coil_calc.aspx calculator gives a nominal inductance of 4 mH, and at 120 Hz the inductive impedance is $$Z = 2\pi fL = (6.3) (120) (.004) = 3 \Omega$$

so I really don't think your setup is likely to work.

  • \$\begingroup\$ Thanks for the suggestions. They sell the coil in 500 gram bundles, so a thinner wire will be longer. Of course, I don't have to use all of it. When you say the setup won't work, you specifically mean the coil resistance will be too high I won't have enough power going through? It's hard to find a transformer that will power the 5V PIC and also supply a decent amount of power to the coil. Many of the higher voltage transformers don't have very low taps, and I don't really want to put a 5V rectifier on a 32V tap. \$\endgroup\$
    – Ozzah
    Commented Jul 25, 2015 at 12:01
  • \$\begingroup\$ No, I mean that your coil (at the size you're talking about) will be too small. It will overload the transformer. You need to find some Australian electronics distributors, not your local hobbyist store, and buy from them. Higher-current transformers are very common. \$\endgroup\$ Commented Jul 25, 2015 at 13:26
  • \$\begingroup\$ I am using an electronics distributor - I'm not sure whether it's appropriate to name drop here. They have spools of 500g enamelled copper wire in 0.4mm thickness, which is ~240m. They have a 2170 type 6A transformer with taps at 12V - 30V. If I understand correctly, the coil needs more turns. At the moment it's acting more like a short circuit than an inductor, which would draw too much current from the transformer? \$\endgroup\$
    – Ozzah
    Commented Jul 26, 2015 at 8:28
  • \$\begingroup\$ I checked that 2170 - it's 12V/15V at 6A, and the 24/27/30V are 3A. I could use the 15 and 24V taps to get 9V for the PIC, but then I wouldn't have a common ground between the 15/24 and the 0/30 sections. I could use 0/12 for the PIC and maybe use a voltage divider so the VR isn't glowing hot? \$\endgroup\$
    – Ozzah
    Commented Jul 26, 2015 at 9:54
  • \$\begingroup\$ How much current does the PIC take? 12v at (for instance) .25 amps is only 3 watts, with the VR soaking up about 2/3, or 2 watts. Sure, you need a decent heat sink, but not a heroic one. \$\endgroup\$ Commented Jul 26, 2015 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.