# First proper circuit - am I doing anything silly?

#### Gump

Joined Jun 7, 2010
57
Hello,

You'll have to forgive me, I hope I'm not asking too much, this is my first circuit that is actually useful. I've simulated it in both the demo versions of ISIS Proteus and LTSpice with no issues at all, but I really would appreciate it if somebody here could take a look at the circuit to make sure I'm doing nothing too silly.

What happens is when the button is pushed down (connected to RB0/INT pin on uController), it outputs high on RA2 and RA3 and so should close the relays, otherwise a low is outputted and the relays are opened. Just a couple of notes:

1) I'm having to simulate the player with a resistor. The player needs 3.7V and pulls typically between 50mA and 100mA (I can't find out exactly so I went for an average of 75mA), so I calculated the appropriate resistor with: $$R=\fra{V}{I} = \fra{3.7}{0.075} = 50\Omega$$

2) The relays have the following properties:
Part Number: EDR201A1200
Nominal Voltage: 5V
Pull-in Voltage: 3.75V
Dropout Voltage: 0.8V
Coil Resistance: 500Ω
Nominal Input Power: 50mW
although as the uController is running at 4.5V I am actually running under the nominal voltage but still well above the pull-in voltage, I'm assuming this will be fine.

3) The resistor in the power terminals circuit connected to MP3VDD is there to (obviously) reduce the voltage applied to MP3VDD (which should be 3.7V rather than the 4.5V that would be supplied without the resistor).

4) As I say I've ran power terminal circuit through LTSpice swapping the terminals for resistors to simulate the loads, and I have the following:

uController current: 100uA
uController dissipation: 450uW
MP3 resistor current: 73mA
MP3 resistor dissipation: 59mW
MP3 player current: 73mA
MP3 player dissipation: 272mW
Speaker current: 500mA
Speaker dissipation: 3W
(V1, V2, V3) current: 573mA
(V1, V2, V3) dissipation: 860mW
V4 current: 500mA
V4 dissipation: 750mW

I think this all seems in line with what is expected. The circuit won't actually be on for more than perhaps 2-3 minutes every day, but I'm after fairly high capacity 1.5 batteries so it can last as long as possible, can anybody recommend a decent type?

Thanks,
Gump.

Edit: Sorry, just to say that the player on the circuit attachment is still 50Ω, this should be 75Ω.

#### Attachments

• 130.8 KB Views: 48
• 107.5 KB Views: 27
Last edited:

#### Wendy

Joined Mar 24, 2008
22,360
To the best of my knowledge lithium is king in longevity. Just get you a battery holder and go with it. Lithium batters are expensive though, but have superior discharge specs and wide temperature specs. I use them for my remote outdoor thermometer sensor. They also create 1.25VDC.

Loose the relay and replace it with something solid state. ALL relays are power hogs.

#### tracecom

Joined Apr 16, 2010
3,944
I see you have changed the arrangement of the caps on the crystal since your last thread.

#### SgtWookie

Joined Jul 17, 2007
22,221
For simulating the player in LTSpice, use a current source that is a pulse, when off it's 50mA, on is 100mA, and check the "load" box.

Your batteries will be more like 1.25v each, so the relay voltage will be ~3.75 when the batteries are fresh. This is right at the pull-in voltage. Operation will not be reliable. Instead of relays (which are power hungry) consider using logic-level power MOSFETs.

The 11R resistor in series with the PM3VDD is a very poor way to regulate the voltage. You actually need to use a low-dropout regulator (LDR) to provide active regulation rather than a resistor. You'll see how poor the voltage regulation is when you substitute the current source as a load.

I don't know why you are supplying voltage to a speaker. Are you meaning to convey that the speaker is an amplified speaker and you are supplying power to the amplifier? If so, that's OK - but use a power MOSFET instead of a relay.

#### Gump

Joined Jun 7, 2010
57
Hello everybody,

Thanks very much for the replies.

To the best of my knowledge lithium is king in longevity. Just get you a battery holder and go with it. Lithium batters are expensive though, but have superior discharge specs and wide temperature specs. I use them for my remote outdoor thermometer sensor. They also create 1.25VDC.
Hm, I'd prefer lithium then, I've had a look at the Energiser site and they do lithium AA and AAA batteries that give 1.5VDC which I'm imagining should be okay?

I see you have changed the arrangement of the caps on the crystal since your last thread.
Hehe, yeah, seemed I was missing a couple of important wires.

Your batteries will be more like 1.25v each, so the relay voltage will be ~3.75 when the batteries are fresh. This is right at the pull-in voltage. Operation will not be reliable. Instead of relays (which are power hungry) consider using logic-level power MOSFETs.
Ah, that's a bit of a kicker. I'll have a look at different MOSFETs... Thansk for spotting that one.

The 11R resistor in series with the PM3VDD is a very poor way to regulate the voltage. You actually need to use a low-dropout regulator (LDR) to provide active regulation rather than a resistor. You'll see how poor the voltage regulation is when you substitute the current source as a load.
Why is this? I don't know too much about LTSpice (just downloaded it a few hours ago and saw it for the first time really), but I think I have set up the current source as a pulse correctly, but I cannot see what detrimental effect this is having? I have uploaded the spice circuit...

I don't know why you are supplying voltage to a speaker. Are you meaning to convey that the speaker is an amplified speaker and you are supplying power to the amplifier? If so, that's OK - but use a power MOSFET instead of a relay.
Yes, sorry about that. It's a rubbishy portable speaker that has a built in amp powered by 6V 0.5A, so I've been (incorrectly) referring it to as just a speaker rather than the amp.

I'll get the changes made today and will reply with the updated things. Thanks all very much for your input, it's really appreciated.

Gump.

#### Attachments

• 1.6 KB Views: 12
Last edited:

#### SgtWookie

Joined Jul 17, 2007
22,221
Look at how the voltage changes between R1 and I1 when the current changes.

I don't know why you have a 45k resistor labeled PICVDD. If that's to simulate the PIC as a load - well, OK - but the PIC will have lots of noise on it's supply.

#### Gump

Joined Jun 7, 2010
57
Look at how the voltage changes between R1 and I1 when the current changes.
Ah yes! I see what you mean now... 3.5V to 4.0V, that is a bit of a change...

If that's to simulate the PIC as a load
You've got it. I can't simulate a pic in LTSpice so I just placed a generic resistor there with the expected resistance.

...but the PIC will have lots of noise on it's supply.
I'm sorry, I can't say I understand what you mean here...

By the way, hope you don't mind but I'm going to have to get to bed now - I shall pick this up in a few hours if that's okay.

Thanks.

#### SgtWookie

Joined Jul 17, 2007
22,221
Sure, no problem. This board is not interactive; it may be days between replies.

Meanwhile, when you come back have a look at the attached.

It's still basically your circuit, but I've flipped things around, and replaced a couple of the resistors with current sources wired as loads. The PIC has two different load levels; it's slowed down otherwise the simulation takes a long time to run. The amplifier has a 0.4A average load, which varies from 0.3A to 0.5A, and the load is sinusoidal in nature.

I put caps across both the PIC and the amp. You can play with the values of the caps to see what happens to the noise.

I gave the batteries some resistance. When batteries are very fresh, their internal resistance is low. As they become discharged, their internal resistance increases. While it may be successfully argued that the resistance values I've elected to use aren't the resistance of your batteries when new, they WILL match the resistance AT SOME POINT in time.

This certainly isn't meant to be an exhaustive simulation - just a rough idea of what will be happening.

#### Attachments

• 2.4 KB Views: 13

#### Gump

Joined Jun 7, 2010
57
Hi SgtWookie,

Sure, no problem. This board is not interactive; it may be days between replies.
That may be the case, although since I'm the one asking the question I think it would be a bit rude for me to just disappear after people have put effort into replying without at least saying I'm going to be AFK.

Meanwhile, when you come back have a look at the attached.
Thanks so much for your effort! I can see what you mean regarding the batteries and the different loads, seems I imagined things to be a little too perfect. Even though you say it's not a perfect simulation it's better than mine; so much so, I'm wondering if the power circuit is very wrong (more on this later).

I've spent the past couple of days staring at component seller websites, datasheets, spice circuits etc. trying to find the right components from the right places and to be honest I'm really losing patience with this - well to be more correct, the datasheet part of things. It seems most datasheet writers throw everything on, and I'm sure they're all important details that I just don't understand yet, but it's completely overwhelming and can be incredibly disorganised. It doesn't help that there may be half a dozen specs of similar parts given on the same sheet with only small asterisks to make you aware of the details. Also, when I find a part, it doesn't appear to exist in LTSpice, so I cannot simulate its effects.

Anyways, I've been looking at the previous recommendations. Regarding the replacement of relays I think I may have found a suitable component. The MOSFET is a STP36NF06L and the datasheet is here. I've uploaded a picture of the output characteristics graph (Page 6, Figure 3), and the gate threshold value is 1V to 2.5V, so I'm guessing it should be okay. I'm not too sure about MOSFETs yet, but if I'm reading it correctly, the output graph shows that with a gate voltage of 4V, which should be fine as the microcontroller that switches it must have a minimum of 4V itself, as this would allow current of a few amps.

As for your updated circuit, the microcontroller must be between 4.0V and 5.5V, yet your spice model (thank you!) shows that the voltage to the microcontroller varies it seems from 4.14V to 4.29V, I imagine this is cutting things a little too close. I've changed the circuit slightly (see the upload) so that the four cells are in series so all components are given the full voltage.

When I do this the microcontroller has a voltage between 5.72 and 5.52, which is above the maximum (5.0V), if I insert a fixed 5V low drop-out regulator (perhaps this one), just before the pic, would this suffice? That particular part has a drop-out voltage of 380mV.

Things get very complicated for me when it comes to the player. I've had a look at what seems like all variable low drop-out regulators but the datasheets make the required accompanying circuit look far too complicated to bother with. I'm assuming that if I used the same 5V regulator just mentioned along with a series resistor I would have the original problem? One variable regulator that I have seen is the LP2951AC (datasheet here), it seems to have the exact same characteristics as the above regulator 2950 (in fact seems to share the same datasheet), but it allows for variable adjusting. Do you know of any component that is in LTSpice that would be suitable enough for me to simulate the 2950/2951?

Thanks for you help.
Gump.

#### Attachments

• 28.3 KB Views: 14
• 8.6 KB Views: 16
• 2.5 KB Views: 10