Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with using a microcontroller to control a motorized toy

Status
Not open for further replies.

172pilot

Newbie level 2
Joined
Jan 26, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,324
Hi,

I've got a project that I THOUGHT was going to be simple, but has turned out to be a bit tough..
I have a small toy dog that runs off of 2x AA batteries (3v) and when switched on, just walks around and "barks". What I need to do, is to use a big button (think "Easy Button" at staples) to trigger the dog to turn on for a specified amount of time (5 seconds or so).

This will be used for teaching special needs children.

My initial thought was to embed a small 8 pin microcontroller in the dog, and expose only a 1/8" jack to connect to an external switch that the school already has for use with similar commercially sold toys, but to open the toy and modify it in that way would be difficult, and I'm afraid my "toy surgeon" skills would mean the toy would never be the same, so I have opted to design it such that the toy will stay on, but I'm going to interrupt the power to the toy through 2 wires running to it from whatever button I choose (Since the "smarts" get moved outside the toy in this situation, I think I'm going to use an actual Staples brand "easy button" because it already can house the circuitry and batteries for my circuit.

OK.. So, that's the requirement.. now, my thought of the design..

My initial thought was that I'd program a microcontroler to monitor the button, do the timing, and use a TTL output to turn "on" to turn on the toy. THis much is a piece of cake.. no problem, already have code to test with. My problem is that from the TTL output, I had HOPED to just use a transistor to ground the toy and turn it on. In the past, I've use an NPN transistor to switch on a relay for other purposes. I was hoping that my toy would be the load, like the relay was, and it would turn on.

Unfortunately, this isn't working for me. It's killing the whole circuit. I THINK it might be that the toy is taking too much current, and killing the microcontroller, but I have verified that the micro is still running because if I hook an LED to the output, even though the LED goes dark when I connect the toy, the duty cycle of the counter continues while dark, and it lights back up in the same phase of my loop when I remove the toy (I hope that makes sense)...

89_1327605133.gif


Does anyone have any ideas? What else can I answer about my attempts? I've tried to upload a .GIF file picture of the basic idea I am trying to duplicate regarding the transistor, but I dont know if it went or not, so hopefully I've explained it in the text!

Thanks in advance for any help!
-Steve
 

mister_rf

Advanced Member level 5
Joined
Feb 26, 2008
Messages
1,874
Helped
1,040
Reputation
2,088
Reaction score
953
Trophy points
1,393
Location
Romania
Activity points
11,519

172pilot

Newbie level 2
Joined
Jan 26, 2012
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,324
OK.. I was afraid of that.. I thought of using a relay, but if I do that, then my power supply for the toy can be completely separate from the circuit, which I guess is a plus in some ways, and I think I'll order some of the parts you mention, but I'd also be curious if there's a way to do it w/o a relay..

Thanks!
 

mister_rf

Advanced Member level 5
Joined
Feb 26, 2008
Messages
1,874
Helped
1,040
Reputation
2,088
Reaction score
953
Trophy points
1,393
Location
Romania
Activity points
11,519
In other words let me rephrase that . You can use also the N-MOSFET without the relay, just we need a MOSFET operating down to 2.5-3 volts, see the examples I have indicated.

Also I have made experiments using some bipolar transistors.

Initial setup: 3V power supply and 220 ohms base series resistor.
First testing the ZTX853
**broken link removed**
R load = 2.2 ohms -> Vce= 0.175V,
R load= 4.4 ohms -> Vce = 0.1V

Second I have replaced by 2SD965
https://www.utc-ic.com/spec/2SD965_A.pdf
R load = 2.2 ohms -> Vce= 0.2V
R load= 4.4 ohms -> Vce = 0.11V
So I think there’s also a possibility to use very low saturation voltage bipolar transistors.
 
  • Like
Reactions: mihum

    mihum

    Points: 2
    Helpful Answer Positive Rating

umairk90

Newbie level 4
Joined
Oct 4, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
hi, i am having problem with these relays in this cricuit....some times they activate sometimes they dont... the 89c51 part is working fine as i have checked it by placing leds at the output of uln 2803... but i guess there is some problem in relay based circuitary.... can any one help me out plz...!

 

mister_rf

Advanced Member level 5
Joined
Feb 26, 2008
Messages
1,874
Helped
1,040
Reputation
2,088
Reaction score
953
Trophy points
1,393
Location
Romania
Activity points
11,519
On the ULN2803 circuit disconnect pin 10 from +5V and reconnect it to +12V.
And, what about grounding for this circuit? The pin 9 must be connected to GND.
 

Attachments

  • 62_1327694569.jpg
    62_1327694569.jpg
    224.6 KB · Views: 14
Last edited:

mister_rf

Advanced Member level 5
Joined
Feb 26, 2008
Messages
1,874
Helped
1,040
Reputation
2,088
Reaction score
953
Trophy points
1,393
Location
Romania
Activity points
11,519
but I'd also be curious if there's a way to do it w/o a relay..
;-)

And another very simple solution just using parts from a defective LiPol battery .
For that we need only the power MOSFET without the battery monitoring circuit, see the attached pictures.
I have tested this idea for two Nokia 3.7V battery (model BL-5C and BL-5F) and I get some nice results.
For a power supply of 3V we can draw up to 1.5A form this circuit if we apply as low of 2V gate to drain control voltage, resulting in a minimum of 0.1V-0.12V drain to source voltage.
 

Attachments

  • Batt_2_v1.JPG
    Batt_2_v1.JPG
    77.2 KB · Views: 19
  • Batt circuit_1a.JPG
    Batt circuit_1a.JPG
    107.4 KB · Views: 18
  • Mosfet _v3a.JPG
    Mosfet _v3a.JPG
    71 KB · Views: 21
  • MOSFET connection.jpg
    MOSFET connection.jpg
    83.5 KB · Views: 19
  • Like
Reactions: mihum

    mihum

    Points: 2
    Helpful Answer Positive Rating

umairk90

Newbie level 4
Joined
Oct 4, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
On the ULN2803 circuit disconnect pin 10 from +5V and reconnect it to +12V.
And, what about grounding for this circuit? The pin 9 must be connected to GND.


thnx for reply, i have replaced 5 by 12v and i am using a reset circuit in hardware which is working... but still the problem exists!! what do you think about relay circuitary ?? the power change i have used through relays.. is that ok??
 

umairk90

Newbie level 4
Joined
Oct 4, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
yup I have grounded pin 9 of ULN2803 to the ground!!

---------- Post added at 15:32 ---------- Previous post was at 15:29 ----------

Have you connected ULN2803 pin 9 to GND?

yup i have grounded it... but there is still the problem... I guess the relays have some problems... should i use diodes or capacitors with it?
 

wa1kij

Advanced Member level 4
Joined
Oct 19, 2011
Messages
105
Helped
18
Reputation
36
Reaction score
15
Trophy points
1,298
Location
Cape Cod
Activity points
1,845
It's traditional to put a diode in parallel with a relay coil to prevent a reverse-current surge when the relay is de-energized.
 

umairk90

Newbie level 4
Joined
Oct 4, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,325
It's traditional to put a diode in parallel with a relay coil to prevent a reverse-current surge when the relay is de-energized.

i have used 3 amp diodes parallel to relay coil... but still the problem persists.... what abt capacitors.. why are they used??
 

mister_rf

Advanced Member level 5
Joined
Feb 26, 2008
Messages
1,874
Helped
1,040
Reputation
2,088
Reaction score
953
Trophy points
1,393
Location
Romania
Activity points
11,519
For me it’s not so clear, what type of relays are you using now? Give more details about.
Witch relays does not work any more? Is there a special program configuration when errors occur, or suddenly it happens ?
First try to measure the ULN2803 output voltages in different situations.
 
  • Like
Reactions: mihum

    mihum

    Points: 2
    Helpful Answer Positive Rating

wa1kij

Advanced Member level 4
Joined
Oct 19, 2011
Messages
105
Helped
18
Reputation
36
Reaction score
15
Trophy points
1,298
Location
Cape Cod
Activity points
1,845
Are the relay coils 12VDC? If there's 12 volts getting to the top of the coils, and 0 volts at the ULN2803 output, the relays should be working consistently. If you could look at the outputs with a scope, you could see how it's behaving. As for capacitors, I don't know how they would help, unless a scope showed some oscillation which they could be used to neutralize.
 

papunblg

Advanced Member level 3
Joined
Oct 22, 2010
Messages
726
Helped
172
Reputation
344
Reaction score
165
Trophy points
1,343
Location
Kolkata India
Activity points
6,437
hi, i am having problem with these relays in this cricuit....some times they activate sometimes they dont... the 89c51 part is working fine as i have checked it by placing leds at the output of uln 2803... but i guess there is some problem in relay based circuitary.... can any one help me out plz...!


There is no attached code. I dont now how(sequence) the relays are getting activated. But remember that for ULN2803 the current that each output can give depends on the number of outputs used and the duty cycle.

Also as you were told, connect pin9 of ULN2803 to the ground.
 

allenf

Member level 3
Joined
Jul 19, 2011
Messages
66
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,288
Activity points
1,744
bin it use a real dog much more entertaining kids love dogs

sorry LOL
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top