I am looking for a simple (and cheap) way to turn a motor on based off of input from a sensor.
I was thinking of attaching a DC motor https://www.adafruit.com/products/711 to Trinket 5V https://www.adafruit.com/products/1501.
Can I run a 9V battery to the trinket to control the DC motor when the sensor is triggered?
This motor nor the 9V battery are a must. I can use AA batteries and another DC motor (tho the price of this one is attractive).
jbc
Trinket and DC motor
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Trinket and DC motor
You can't switch a motor directly from a Trinket output. But for a small motor like that, you just need a small transistor. This guide shows how to wire and program it for an Arduino. You may need to use a different pin, but the same circuit and code should work on the Trinket.
https://learn.adafruit.com/adafruit-ard ... -dc-motors
https://learn.adafruit.com/adafruit-ard ... -dc-motors
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
AFTER LOOKING AT THAT GUIDE IT LOOKS LIKE i COULD SOLDER THE PARTS TOGETHER to avoid a a breakout board no?
It looks like it.
Would the trinket and 3 AA batteries give that motor the juice it needs?
Or would the 3V trinket and a 9V battery work better?
It looks like it.
Would the trinket and 3 AA batteries give that motor the juice it needs?
Or would the 3V trinket and a 9V battery work better?
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Trinket and DC motor
You could probably wire it direct. Just be careful that the component leads are not subject to a lot of bending. They will break if subjected to repeated stress. You can solder the diode between the motor terminals. The transistor is a little trickier.
3xAA or 4xAA will work much better than the 9v. A 9v will give you more voltage to start, but it doesn't have much capacity and will fade fast driving a motor.
3xAA or 4xAA will work much better than the 9v. A 9v will give you more voltage to start, but it doesn't have much capacity and will fade fast driving a motor.
- zener
- Posts: 4567
- Joined: Sat Feb 21, 2009 2:38 am
Re: Trinket and DC motor
Depending on the sensor you could possibly eliminate the Trinket. Just go sensor>transistor>motor. However it is no longer "smart" at that point, just on - off.
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
Im looking for a smart version but thanks for the input Zener.
Bill-
I think I'll try your approach.
If get one of each; Plus a 5V trinket + a 3AA battery pack https://www.adafruit.com/products/727
to run this smart sensor motor controller.
Do the parts look right?
jbc
Bill-
I think I'll try your approach.
If get one of each; Plus a 5V trinket + a 3AA battery pack https://www.adafruit.com/products/727
to run this smart sensor motor controller.
Do the parts look right?
jbc
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Trinket and DC motor
Yes. That looks right.
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
Bill can you give me a link to the 270 Resistor please? I can't find it on your site.
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Trinket and DC motor
We don't have any through-hole resistors in the store at the moment. You can try Radio Shack or Mouser.
If you plan on more projects in the future, there are some nice reasonably priced assortments out there too.:
http://www.amazon.com/s/ref=nb_sb_noss_ ... =resistors
If you plan on more projects in the future, there are some nice reasonably priced assortments out there too.:
http://www.amazon.com/s/ref=nb_sb_noss_ ... =resistors
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
Thanks Bill.
I found these- E-Projects - 270 Ohm Resistors - 1/4 Watt - 5% - 270R
I want to check the details before I hit the 'buy' button and I dont know what the '1/4 Watt-5%' means.
http://www.amazon.com/E-Projects-Resist ... m+resistor
jbc
I found these- E-Projects - 270 Ohm Resistors - 1/4 Watt - 5% - 270R
I want to check the details before I hit the 'buy' button and I dont know what the '1/4 Watt-5%' means.
http://www.amazon.com/E-Projects-Resist ... m+resistor
jbc
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Trinket and DC motor
1/4 watt means it can dissipate 1/4 watt (e.g. 200mA @5v) which is plenty for this application.
5% is the tolerance - i.e. 270 ohms +/- 5%. Also more than precise enough for this application.
5% is the tolerance - i.e. 270 ohms +/- 5%. Also more than precise enough for this application.
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
Thanks for the speedy response.
You have helped take the edge off of trying out new things.
I'm sure I'll be back on this thread over the weekend once I start soldering.
Thanks.
jbc
You have helped take the edge off of trying out new things.
I'm sure I'll be back on this thread over the weekend once I start soldering.
Thanks.
jbc
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
Bill,
I want a sensor when it hits a resistance value that is written in the code turn on a motor for x amount of time.
Does the wiring look right?
(The diode is between the motor terminals)
I want a sensor when it hits a resistance value that is written in the code turn on a motor for x amount of time.
Does the wiring look right?
(The diode is between the motor terminals)
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Trinket and DC motor
It looks like you are connecting both the sensor and the transistor base to pin #0. That won't work. They pin can't be both an input and an output at the same time.
To read a resistive sensor, you need to use an analog pin. Pin #2 can be used as an analog input: https://learn.adafruit.com/introducing-trinket/pinouts
To read a resistive sensor, you need to use an analog pin. Pin #2 can be used as an analog input: https://learn.adafruit.com/introducing-trinket/pinouts
- jbc
- Posts: 159
- Joined: Wed Aug 14, 2013 7:18 pm
Re: Trinket and DC motor
OK.
My diagram in all it's glory (ignore my spelling of 'resistor' and 'transistor.' This pic seem's to be 's' deficient).
If this looks right I'll start soldering away this weekend.
If wired correctly I hope to get a motor to turn for 10 seconds (or whatever I code for) when the resistive sensor value is reached, powered by 3 AAA batteries.
My diagram in all it's glory (ignore my spelling of 'resistor' and 'transistor.' This pic seem's to be 's' deficient).
If this looks right I'll start soldering away this weekend.
If wired correctly I hope to get a motor to turn for 10 seconds (or whatever I code for) when the resistive sensor value is reached, powered by 3 AAA batteries.
Please be positive and constructive with your questions and comments.