• 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.

Mrclox

New Member
Hi
I have the following idea for a simple circuit. I plan to make a few of these and so would need a circuit diagram, code for the micro controller and the hardware with which to program the controller.

On a model helicopter you have a gyro which keeps the tail pointing in the direction you set it. The amount by which the gyro works called the gain is controlled from the transmitter to a seperate channel on the receiver in the heli and is sent on a single wire from the receiver to the gyro.

What i want is a unit that sits between the receiver and the gyro and when a button is pressed on the unit it records the gain, so that when the receiver is powered up again if the gain amount is different from that recorded a buzzer will sound for a while (20-30 secs). However if the gain is changed whilst powered up the buzzer will not sound.

I am willing to pay for this but i dont know where i can get this done
 

mike50

New Member
I actually built something like this a while back. What my unit did was to track the gain value from the receiver (one channel used to set gain from transmitter). It remembers the last gain value that it sees and passes that value through to the gyro. Once you have the gain where you want it, you simply unplug the unit from the receiver. When the unit gets no input from the receiver, it supplies the last gain value it saw continuously to the gyro.

The gain value is remembered across powering off too.

Would that do what you want?

Mike
 
Last edited:

Mrclox

New Member
Ha thats close but no... the idea is i want to be warned if the gain is different from last time not auto changed , but thanks...
 

Sceadwian

Banned
No that wouldn't. He wants an alarm if the gain value is different from when the receiver was last turned off, or set. I was going to do this last week but forgot, sounds like you have something that would be easily modified to do what he's asking.
 

mike50

New Member
I understood that what I suggested isn't what you asked for, but it wasn't clear why you asked for that. I assumed that you wanted the warning for the case where the gain was not what you last set it to (as in, maybe you had used the transmitter for something else). I assumed that if you heard no warning, you would fly without having to reset the gain. In that case, my scheme accomplishes the goal, and perhaps more.

In any event, my circuit and program could easily be modified to do exactly what you asked for. It would be bigger, heavier and more expensive though...with the switch and buzzer.

My circuit was built with a PIC12F683, a bypass capacitor and a resistor to guard against shorts on the output, so it is very simple. Adding the buzzer and switch would also require a couple more resistors and a transistor. Nothing very significant, but much heavier.

Mike
 

Sceadwian

Banned
No switch needed, use a diode before a large filter cap feeding the micro controller and have one of the I/O lines tied on the other side of the diode. The MCU will be able to tell when it loses power and write data to eeprom if the hold up cap lasts long enough. Then whenever you turn the heli off it will remember it's last setting.
 
Last edited:

mike50

New Member
Sure, if several weeks would be okay.

It could be designed to be used with a Y adapter, where the Y adapter plugs into the receiver and both the gyro and this circuit plug into the Y.

Or, it could be made to pass the signal through. In the latter case, it could also provide the function of my original circuit. It would pass through the signal from the receiver and sound a warning if the signal from the receiver was different at power up than what was last recorded AND if there was no signal from the receiver it would generate what was last recorded (with or without the warning).

How many of these are you planning to make? If a half dozen or less, it would be easy for me to just make them. Or I could just program the chips for you. If you want to make them yourself, would you want surface mount (that is often easiest -- less holes to drill -- if you can solder surface mount parts) or through-hole parts? If I made them, I would use surface mount.

With the buzzer (small piezo buzzer) and small push button switch this would probably end up on about a one inch square board.

Mike
 

Mrclox

New Member
Thanks for reply, no i would not want the feature whereby it restores the last input to the gyro, just the features i have said. I will probably be producing loads of these for everyone at my flying field so i think I would need the whole deal including instructions on programming and the hardware for doing this. As i said i am willing to obviously pay for all the bits and bobs and also a bit for your time. let me know.. (I am quite handy so i guess the the surface mount is fine, whatever is the lightest)
 
Last edited:

mike50

New Member
No switch needed, use a diode before a large filter cap feeding the micro controller and have one of the I/O lines tied on the other side of the diode. The MCU will be able to tell when it loses power and write data to eeprom if the hold up cap lasts long enough. Then whenever you turn the heli off it will remember it's last setting.
So that assumes that you always want it to remember the last input it saw. I assumed that the point of the switch was so that it would remember exactly the value you wanted, not necessarily the last input.

For the automatic writing case, I did this by only recording changes that exceeded 0.1 % (which I found to be sufficient to avoid writes due to "jitter" and at least 2 seconds between writes to the EEPROM. That way no external circuitry is needed and the number of writes is easily kept below the 100,000 maximum. I also alternate between two locations in the EEPROM so that if power is lost during the write, I always have the previous value.

Doesn't using a diode as you suggested put a voltage 1 diode drop above Vdd onto the input pin? That would put the chip out of spec (at least for PICs and AVRs). Maybe use a voltage divider since you would probably need a pull-down resistor anyway.

Mike
 

Sceadwian

Banned
He wants it to remember the value the heli was last turned off at. He's just worried about screwing with his transmitter twisting a knob at the wrong time and altering the gyro gain setting and forgetting about it. When the heli is turned on it will load the last setting it was turned off at and alarm if it's not the same.
Voltage on the input over maximum is fine as long as you use a resistor to limit current to 1ma, they have clamp diodes. There are appnotes for the AVR which use 1meg resistors to connect AVR I/O pins DIRECTLY to mains power for zero cross detect. (I kid you not)
 
Last edited:

mike50

New Member
He wants it to remember the value the heli was last turned off at. He's just worried about screwing with his transmitter twisting a knob at the wrong time and altering the gyro gain setting and forgetting about it. When the heli is turned on it will load the last setting it was turned off at and alarm if it's not the same.
Voltage on the input over maximum is fine as long as you use a resistor to limit current to 1ma, they have clamp diodes.
He never said he wanted to remember the value the heli was last turned off at...he said he wanted a switch. And I had assumed he was worried about the case where the transmitter got inadvertently adjusted, but that could happen while the power was on too...in which case the inadvertent value would be saved.

Limiting the current works, but you still need the pull-down resistor for reliable operation and that results in a voltage divider as i suggested. Without the pulldown resistor the input is floating when the power is switched off.

Mike
 

mike50

New Member
Thanks for reply, no i would not want the feature whereby it restores the last input to the gyro, just the features i have said. I will probably be producing loads of these for everyone at my flying field so i think I would need the whole deal including instructions on programming and the hardware for doing this. As i said i am willing to obviously pay for all the bits and bobs and also a bit for your time. let me know.. (I am quite handy so i guess the the surface mount is fine, whatever is the lightest)
If you build these yourself, can you make printed circuit boards?

Surface mount parts require some precision in making the boards. Since through hole parts are a lot bigger, the circuit boards are easier to make, or you can use "perf" board. The design is the same, but the board layout and size will be different.

To write the programs to the chips you need a programmer. For the PIC chips that I use, a simple solution is to use a PICKIT2 programmer (from Microchip -- the maker of the PIC chips). That is about $35. The software to actually use the PICKIT2 to do the programming runs on a PC, not a MAC. The best solution is to be able to program the chips after they are soldered into the circuit (that allows for changes later). That requires some sort of connector on the board too.

Mike
 

Mrclox

New Member
I would want the unit to be as light and small as possible. so if that means learning to etch a copper plate for a circuit board I am willing to learn. I am a jeweller so these things will come naturally to me.
Fine soldering is not a problem for me. I am happy to purchase the pic programmer and I have a PC so we are good to go!
 

Mrclox

New Member
--------------------------------------------------------------------------------

I would want the unit to be as light and small as possible. so if that means learning to etch a copper plate for a circuit board I am willing to learn. I am a jeweller so these things will come naturally to me.
Fine soldering is not a problem for me. I am happy to purchase the pic programmer and I have a PC so we are good to go!
 

Sceadwian

Banned
You'll have to wait for mike50 to post again Mrclox. I'm sorry I haven't had the time to build the circuit I said I was going to. I've had the same idea for what he's said he's done from the start, but it's up to him if he wants to share it. I've had my eye on some of the tinyAVR's for this for years but never got around to building it. 6pin soics like blueroom mentioned. diode fed capacitor to hold power up and a voltage divider to detect system voltage.
 

mike50

New Member
I will come up with a parts list, schematic and board layout this weekend. Hopefully, I'll be able to build a prototype too.

The piezo-buzzer will carry almost all of the weight.

Mike
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top