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.

Simple micro controller circuit and software needed

Status
Not open for further replies.
I've got a circuit designed and built. I can't test completely until I get a piezo buzzer (I should get it in the mail in a couple of days).

I'd prefer to wait on sending the schematic, parts list and board layout until I get a chance to test the prototype.

I've also started on modifying my code.

Mike
 
Nice one
Thanks a lot. look forward to it. Dont forget that the buzzer shouldnt sound if gain is changed mid flight, only if different on start up
 
Last edited:
Here is what I am planning:

  1. Pressing the button at any time will save the current input gain value into EEPROM.
  2. At powerup the input gain value will be compared with the saved value. If it differs (unsure how much difference should trigger alarm) then the alarm will sound for 20 seconds. (should the alarm stop if the gain is adjusted so that it matches the saved value?)
  3. If at powerup the input gain value matches the saved value, the alarm doesn't sound and changes to the gain after power up do not cause the alarm to sound.

Mike
 
Sounds spot on thanks

(should the alarm stop if the gain is adjusted so that it matches the saved value?) ..... no not required

(unsure how much difference should trigger alarm) as little as possible without giving false buzz? not sure practically how much that would be
 
I've completed the board and software and I think it does exactly what you wanted.

I've attached pictures of the completed circuit.

Mrclox, if you PM me your name and address, I'll mail you the board so you can see if it is what you want.

Mike
 

Attachments

  • P1010080-xx.jpg
    P1010080-xx.jpg
    83.6 KB · Views: 147
  • P1010085-xx.jpg
    P1010085-xx.jpg
    162.2 KB · Views: 151
There's no protection circuitry on that, at the very least you should put a 10ohm or so series resistor inline with the chips VCC line.
 
Well I guess you don't need reverse polarity protection. Over voltage might be nice though, a fresh 5 cell pack will put out slightly better than 7 volts for a bit, don't know if the pic would survive that for long. Is that a piezo speaker or a buzzer? I wouldn't think you'd need the transistor.
 
Just a suggestion to your "UI".

On Power Up - if the gain is CORRECT - have the device "chirp" twice.

This way you get positive confirmation that the "gain monitor" is operational, and that your settings are correct. Otherwise if the board fails (broken wire to the Piezo anyone??), you may never know until it is too late.
 
Sceadwian,

A resistor isn't going to help with over voltage. The PIC only draws about 1 ma. At 1 ma, a 10 ohm resistor would only drop 0.01 volts.

It is a piezo sounder, but its spec sheet didn't indicate its current draw, so I figured that the FET would be cheap ($0.25) insurance.


MrClox,

The PIC is only rated up to 6 volts. I will add space on the board to add 1 to 3 small diodes that drop about 1 volt each. Add no diodes for 4-cell NiCd or NiMH batteries or 5V BEC circuits. Add one diode for 5-cell NiCd or NiMH batteries and add three diodes for 2-cell LiPoly batteries.

Mike
 
Just a suggestion to your "UI".

On Power Up - if the gain is CORRECT - have the device "chirp" twice.

This way you get positive confirmation that the "gain monitor" is operational, and that your settings are correct. Otherwise if the board fails (broken wire to the Piezo anyone??), you may never know until it is too late.

That sounds like a good idea, and easy to do.

Mike
 
Since the current is so low you could skip the diodes (which would have to be configured for each system) and put a small micropower LDO linear regulator in there. Then it would be a universal solution.

You may need to put a current limit resistors on the I/O line(s) as well, I have no idea what the output impedance of the servo signal line is, but if it can source more than 1ma of current it may fry the I/O line because the voltage will be over the MCU's VCC from the diode or the regulator.
 
Since the current is so low you could skip the diodes (which would have to be configured for each system) and put a small micropower LDO linear regulator in there. Then it would be a universal solution.

You may need to put a current limit resistors on the I/O line(s) as well, I have no idea what the output impedance of the servo signal line is, but if it can source more than 1ma of current it may fry the I/O line because the voltage will be over the MCU's VCC from the diode or the regulator.

I thought about putting a small regulator in place of the diodes, but that would required two more capacitors too. I think that 99% of the cases will be covered by a single diode. It works just fine with 1 diode for all cases except where the power is two LiPoly cells (up to 8.4 volts). That has to be pretty rare because most servos and receivers will fail at that voltage. Most users of two LiPoly cells use a 5 or 6 volt regulator.

I think it unlikely that the receiver output will be greater than 5 volts (most are between 3 and 4 volts), but adding a resistor on the input is cheap protection.

You were right about the transistor. I found that the piezo sounder only draws about 7 ma; well within the capability of the PIC. So I've eliminated the FET.

Mike
 
Mike is that piezo device a buzzer (you just apply DC) or does the PIC drive the buzzer with a timer?
 
Use software PWM. If instead of grounding one pin and turning the other one on and off to get the piezo to sound you swap both legs at the same time it'll double the effective voltage the piezo sees. It should increase the volume. Nigel explained that one to me a while back. It's like using a two way speaker instead of a single ended one.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top