element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Techno Toys
  • Challenges & Projects
  • Project14
  • Techno Toys
  • More
  • Cancel
Techno Toys
Blog This little bug has a bug
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Techno Toys to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: idanre1
  • Date Created: 27 Apr 2017 5:07 PM Date Created
  • Views 3278 views
  • Likes 8 likes
  • Comments 12 comments
  • arduino_projects
  • ttoysch
  • electronictoych
Related
Recommended

This little bug has a bug

idanre1
idanre1
27 Apr 2017

My little daughter threw away this toy and it just stopped working.

image

I had two options:

1. Find the bug and fix it

2. Replace the whole inside with cool stufff.

 

This is the room i have inside:

image

Originally the toy came with 1 motor. There is enough room for two dc motors. Also i have arduino nano and a bluetooth receiver.

The remote control can be my phone, or  i have ps4 remote which is also bt. I just need to figure out if it can be connected to arduino.

 

Update 1:

I have been trying to play with the motor a little bit.

I have been using  2N22222N2222 transistor connected to pwm pin 6 in arduino to drive a simple DC motor driver

I also put IN4007 to protect the arduino against back EMF.

The motol itself was already soldered with 104 capacitor.

 

This is the code i have used:

int MotorPin = 6;  
void setup() {  
pinMode(MotorPin, OUTPUT);  
}  
void loop() {  
analogWrite(MotorPin, 200); //Any value between 0 to 255
delay(4000);//Wait for 10 secs
analogWrite(MotorPin, 100); //Any value between 0 to 255
delay(4000);//Wait for 10 secs

 

 

This is the system I have used (only diff is arduino nano instead of uno and a transformer of 7V instead of a battery):

 

image

 

The real deal:

image

As you can see i am using to original motor from the toy, the black box has a nice mechanism, if you operate the motor with positive polarity both weels turn the same direction, and if you are using reverse polarity each wheel turns a different direction! this way the toy can do acceleration and turn with the same motor.

 

I have been experienced something interesting phenomena that i can't explain:

The code was running for 2 min and after a while, the motor just started operating in a higher speed using the same PWM values.

Is this related to the motor getting warmer or something does it related to  2N22222N2222 operating temperature

I think the increase is about 20% (eye measure)

 

Question for the readers:

The toy itself has a place for 4 AA batteries, it means 7V - PN junction equals ~~ 6V

Do you think I can use a higher operating voltage to make the motor faster or it will be fried?

Without breaking the black box this is the kind of motor i think i have inside:

image

 

Update 2:

I have soldered the circuit on a perforated board.

This is how it looks:

image

and this is the back

image

 

Now I only need the board and stick it inside.

 

The toy face has a cute button that used to make sound when you press it.

image

I plan on drill a big hole and put all the electronics inside the face, since in the body there is no much space because of the motor.

 

Update 3:

I having a problem with my circuit.

image

 

I hope you could see the circuit.

Basically there is a toggle button, if button is pushed than motor should drive, if popped then it should stop.

The third connection from the arduino (except the power/gnd) is the motor control wire which connected to the board I have made and explained in update 2.

It worth mentioning the board is assembled with  2N22222N2222 transistor and 4.7K resistor as explained above

There is also indication, the arduino led is on every time the motor should drive.

 

For some reason when the motor in drive state, it just making weird buzz and don't turn, in rare cases it does.

If I remove the motor when the button pressed and test the open circuit voltage of the motor wires (in the board) I see 6V, but when the motor is connected I only see 0.5V with the multimeter.

So for some reason the motor itself dropping down the voltage.

 

Does somebody understand what's I'm missing?

Am I using wrong type of transistor? wrong value of current limit (the 4.7K in the board)?

 

Update 4:

Using balearicdynamics help I managed making the motor running.

Changing the single transistor to a darlongton pair did the job!

The motor now running without any issue.

Now I can go ahead and continue the proto typing.

I thought maybe adding some music while the bug is moving forward and another while spinning.

 

I have ordered sdcard reader for arduino but meanwhile maybe streaming the music from bluetooth is a better solution because probably I will not get the module on time.

 

I found someone doing it but more work is needed.

Will keep you posted

 

Update 5:

When I started making this project, I have ordered H-Bridge and bluetooth module for arduino. Shipping to my country takes allot and they havn't arrived yet.

Since time is runnig out, I have made a motor driver from darlington pair (for only 1 direction - no H-Bridge) as mentioned above and the communication to the toy is currently from a wire and not wireless since I don't have the BT module.

I managed to stream sound from serial port to arduino, You can check my post: Streaming sound to arduino using serial

     What more special about the streaming code is that you can command the arduino doing things meanwhile you playing music without interrupting the sound.

For this project I have added two opcodes to the streaming program: 'm' to turn on motor and 'M' to turn off the motor.

In the video below you can see they toy playing the streamed sound and behind the scenes I randomally turn on/off the motor from the computer keyboard.

Also if you have ffmpeg+perl you can actually play every sound/movie file you want image which could be nice to have. The gitub readme has the info + scripts for linux

 

I chose for the demonstration kids song which I think suitable for motor like toys image RowRowRow.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Inner implementation I did:

Only the circuit I am holding is my work.

The big PCB on the purpule part is the old one, I just never bothered to remove it and its disconnected from power and not playing part now.

image

image

 

I think this video and the photos are a proof of work that concluding this project, if somebody think I should add more info please share your thought with me.

This project was allot of fun for me, hope to do more in the future

Thanks anybody who helped me along the way.

 

Regards

Idan Regev

  • Sign in to reply

Top Comments

  • DAB
    DAB over 8 years ago +5
    Spoken like a true maker. Devices do not become toss away. They just transform into a newer and neater device. DAB
  • idanre1
    idanre1 over 8 years ago +2
    Moved comment to "update 1" section in main thread Idan
  • idanre1
    idanre1 over 8 years ago in reply to balearicdynamics +2
    Hi I agree with you using tip120 is better. I also got recommendation on irfp064n. The problem is that to my place it usually takes 3 week shipment. Using two 2n2222 is intermidiate solution.... The circuit…
Parents
  • balearicdynamics
    balearicdynamics over 8 years ago

    Hello Idan,

     

    I took a look in depth to your well described steps and some questions arises; in the circuit design the power goes to the motor but I don't see how the Arduino is powered. Are you  using the same battery?

    What is the power of the power supply you are using? If the motor is done to move the toy with 4 AA Batteries, it seems that it is a nominal 7V motor. If you are powering with the same batteries (or equivalent power) the motor and Arduino it is possible that there is not sufficient power for the entire system.

     

    In your update 3 you write:

    For some reason when the motor in drive state, it just making weird buzz and don't turn, in rare cases it does.

    If I remove the motor when the button pressed and test the open circuit voltage of the motor wires (in the board) I see 6V, but when the motor is connected I only see 0.5V with the multimeter.

    If this behaviour is systematic and repeats I suppose there are not components broken or fired. Maybe there is too low power to turn the motor?

     

    Before the tests I suggest below, there is another detail that can make the difference in the case the motor is low powered. Why don't use a Darlington transistor instead of the 2N222? you can try with a TIP120TIP120 that in my opinion sounds better than the one your using now.

     

    In past with DC motors I have experienced using PWM to change their speed that there is a minimum PWM value that enable the motor to start else it just buzz. Maybe that the motor inside of the black box normally is not powered sufficiently to start moving (and moving the mechanism too). Did you tried to change the PWM values for example between 180  (lower) up to 250 (higher) and see what happens?

     

    As the doubtful component is (or maybe) the motor and the circuit power if you have another spare DC motor you can try to use it outside the circuit and see what is the behaviour. Also a LED can be the worth to try testing (add a higher resistor to the end to avoid to fire it). After a couple of tests you have an idea where is the weak point of your project.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • idanre1
    idanre1 over 8 years ago in reply to balearicdynamics

    Hi Enrico

     

    First I want to thank you for your help image

    I will try answering your questions, hope I will not miss anything.

     

    Indeed the power is from the 4AA batteries the same as the original toy, so I guess it should be enough. I also tried to just power the arduino and the motor directly from the batteries (in parallel without the transistor, just dummy connection) and the motor is driving.

    I am pretty sure there is something in the circuit that is not good enough.

     

    I also tried powering the arduino from these batteries and the VDD of the motor from a different 7V transformer (with shared GND) and exprienced the same issue.

     

    I have also tried as you suggested powering the motor with max PWM value (255) and exprienced the 2N2222 getting really hot.

     

    So I guess maybe there is not enough current:

    1. Do you think a different resistor value to the base will increase the current? Will it fry the arduino?

    2. I will try compose darlington from two 2N2222.

     

    I will keep you posted.

     

    Regards

    Idan

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to idanre1

    Hello Idan,

     

    Instead of using a darlington with two 2N222 I will use the TIP120 darlington transistor as I suggested in my previous comment.

    Instead if you should use 2N2222 for some reason please post the circuit you plan to use in this case.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • idanre1
    idanre1 over 8 years ago in reply to balearicdynamics

    Hi

    I agree with you using tip120 is better. I also got recommendation on irfp064n.

     

    The problem is that to my place it usually takes 3 week shipment.

    Using two 2n2222 is intermidiate solution....

     

    The circuit i planned using is just cascade them both as in https://en.m.wikipedia.org/wiki/Darlington_transistor

     

    Idan

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • idanre1
    idanre1 over 8 years ago in reply to balearicdynamics

    Hi

    I agree with you using tip120 is better. I also got recommendation on irfp064n.

     

    The problem is that to my place it usually takes 3 week shipment.

    Using two 2n2222 is intermidiate solution....

     

    The circuit i planned using is just cascade them both as in https://en.m.wikipedia.org/wiki/Darlington_transistor

     

    Idan

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • balearicdynamics
    balearicdynamics over 8 years ago in reply to idanre1

    I see Idan,

    so with the two transistors in cascade we should expect it work (if the batteries have sufficient power). Keep us updated.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube