Hello! I'm new to these forums, and while I know a lot about software engineering, hardware is above me. I've spent a lot of time looking around for something to suit my needs by cannot find anything and though I'm trying to learn, I find myself lacking. If there is a better place to post, please direct me.
I have a CR2012 battery. A very small motor. (6mm diameter..16mm long). I have a very very small space to work in.
I need a small circuit to remotely activate the motor at a very close range. 4ft or less. It doesn't need to be particularly tolerant of other noise in the environment, I don't need perfection...just 'good enough'. I do not have a surface to put an IR sensor, it pretty much needs to be RF. I'm ideally looking for something in the 3mm x 3mm x 3mm size ... but if I have to, I might be able to get a little more room. If I have to hold a button on a transmitter to keep it going, that suits my needs. If I can toggle on/off that's even better...but not required. I have a little bit of room to coil an antenna with a small wire underneath a plastic surface, but not too much.
Any guidance from people who know what they are doing would be excellent!
Thanks.
[UPDATE]
Its been a long journey but I was finally able to get a fully functional build that is stable. This is a roughly drawn version of the final design
Thanks to everyone for your help, but an extra thanks to Ya'akov who pointed me down this path. I've had lots of fun learning how to use an MCU. It felt quite daunting at first but taken in steps I finally got there.
The challenge of this project wasn't merely the function, but that I was unwilling to budge on any dimension of the model, so it would be indistinguishable from the non-functional models I already had.
For anyone wanting to learn how to work with an MCU, I highly recommend taking up the challenge, I already have numerous projects in mind and look forward to all the opportunities to learn new things. Especially combined with a 3D printer, imagination is really the only limitation.
If anyone reading this down the road is curious....this is a brief version of the journey. There were a lot of times I wanted to throw in the towel but push on!
1. First, I picked up an Elegoo UNO (it is essentially identical to Arduino UNO).. there are many similar kits, it doesn't have to be this one specifically, but it really is a great place to start. https://www.elegoo.com/en-ca/products/elegoo-uno-project-super-starter-kit as an example.
2. I learned how to simply make a led blink. Lots of example tutorials, it really is a good place to start
3. I built my circuit using the steady power from the Arduino, the Arduino as the 'brain' of the operation, and the random parts that came in the starter kit I had bought. Once I got the arduino IDE going and the blinking tutorial working, this was actually relatively simple. There are many infrared libraries out there and with some trial and error I found one that did the job with minimal overhead.
4. I researched, found, and purchased components that would physically fit in my model with a little breathing room for my big clumsy hands trying to solder things.
5. I built the circuit using the components I bought, but still with the Arduino as the brain.
6. Finally I was ready to try using the ATTINY85s. This took a little doing to find the right settings, but once I got the hang of it, I learned to program an ATTINY to blink a led.
7. Now I built my prototype circuit using all the hardware that would be in the model.
8. I iterated from here many times improving the software. Adding support for "Magiquest" wands, speed controls, and I even added the ability to program the chip 'after the face' using EEPROM to respond to a different number on the IR remote control I had. So I could toggle specific models on and off, or turn all models on and off with different button -- but the actual programming on the ATTINY would be the same for them all.
9. Getting close, I now tackled my last problem. Power consumption. Up until this time I had been using the nice clean power from the board, and found that the coin battery I wanted to run this on couldn't supply the power so evenly, especially when I toggled the motor on. The noise from the DC motor would often interfere with the IR sensor so you wouldn't be able to turn it off. Adding a capacitor on the power source cleaned this up.
10. I wanted to be able to leave batteries in these models, but using a CR2012 only has 50mah in it. So any power consumption beyond a trickle would quickly kill the battery. The first thing I found was that my original design had the IR sensor being powered directly from the power source. This was a constant drain even when nothing was happening. So I moved the powersource for the IR sensor to an output pin of the ATTINY. This allowed me to programmatically turn the sensor on and off.
11. Even trying to be very conservative, the battery would not last more than a couple days if it was constantly checking for signals. The model is being used for a board game, and they typically last about 4 hours . So I decided after four hours, I'd have the ATTINY completely power down....and use a reed switch to be able to run a magnet by the model to reset the ATTINY and power it back up when we start a new game.
12. I noticed even in a completely powered down state, that the IR sensor was pulling 0.08mah when the ATTINY was sleeping. This doesn't seem like much, but when you only have 50mah battery life, that will drain it in about a month. This was driving me batty as I could not explain why it was draining the power.
13. I finally asked for help on this, and in asking for help, I realized the problem. (explain problems to other people is a great way of solving them. You end up seeing things you've overlooked). The documentation for the ATTINY says that when sleeping, you should set all unused pins to "INPUT_PULLUP" mode. It ensures they have a fixed state. I was also setting my used pins to INPUT_PULLUP as well. What I realized, is that INPUT_PULLUP ensures a positive bias on the pin, by connecting a 10k resistor from VCC to the pin. On my used pins though, this was letting a small amount of power trickle through to the IR sensor and the transistor. Once I changed that to be "INPUT" (which no longer would include the 10k resistor), the power trickle went away.
14. Then it was time to tweak my 3D models to make a little more room for the components, and go to work on assembling them. This was tedious and error prone. I have no experience putting something like this together and found it very frustrating. By the end though, I finally got all to work, and sealed up in the model, and I think my next project will be much much easier.
15. Enjoyed my new toy.
I will add some pictures and maybe a little demo after I have the model painted up. Thanks again everyone!
All in all, this process probably took about 60 hours to learn, design, and build the model -- but I feel much more confident going in to future projects and I'm very excited at the possibilities of using a MCU. While they are a little daunting at first, The possibilities and functions built in to those tiny little things is outstanding!
I have a CR2012 battery. A very small motor. (6mm diameter..16mm long). I have a very very small space to work in.
I need a small circuit to remotely activate the motor at a very close range. 4ft or less. It doesn't need to be particularly tolerant of other noise in the environment, I don't need perfection...just 'good enough'. I do not have a surface to put an IR sensor, it pretty much needs to be RF. I'm ideally looking for something in the 3mm x 3mm x 3mm size ... but if I have to, I might be able to get a little more room. If I have to hold a button on a transmitter to keep it going, that suits my needs. If I can toggle on/off that's even better...but not required. I have a little bit of room to coil an antenna with a small wire underneath a plastic surface, but not too much.
Any guidance from people who know what they are doing would be excellent!
Thanks.
[UPDATE]
Its been a long journey but I was finally able to get a fully functional build that is stable. This is a roughly drawn version of the final design
Thanks to everyone for your help, but an extra thanks to Ya'akov who pointed me down this path. I've had lots of fun learning how to use an MCU. It felt quite daunting at first but taken in steps I finally got there.
The challenge of this project wasn't merely the function, but that I was unwilling to budge on any dimension of the model, so it would be indistinguishable from the non-functional models I already had.
For anyone wanting to learn how to work with an MCU, I highly recommend taking up the challenge, I already have numerous projects in mind and look forward to all the opportunities to learn new things. Especially combined with a 3D printer, imagination is really the only limitation.
If anyone reading this down the road is curious....this is a brief version of the journey. There were a lot of times I wanted to throw in the towel but push on!
1. First, I picked up an Elegoo UNO (it is essentially identical to Arduino UNO).. there are many similar kits, it doesn't have to be this one specifically, but it really is a great place to start. https://www.elegoo.com/en-ca/products/elegoo-uno-project-super-starter-kit as an example.
2. I learned how to simply make a led blink. Lots of example tutorials, it really is a good place to start
3. I built my circuit using the steady power from the Arduino, the Arduino as the 'brain' of the operation, and the random parts that came in the starter kit I had bought. Once I got the arduino IDE going and the blinking tutorial working, this was actually relatively simple. There are many infrared libraries out there and with some trial and error I found one that did the job with minimal overhead.
4. I researched, found, and purchased components that would physically fit in my model with a little breathing room for my big clumsy hands trying to solder things.
5. I built the circuit using the components I bought, but still with the Arduino as the brain.
6. Finally I was ready to try using the ATTINY85s. This took a little doing to find the right settings, but once I got the hang of it, I learned to program an ATTINY to blink a led.
7. Now I built my prototype circuit using all the hardware that would be in the model.
8. I iterated from here many times improving the software. Adding support for "Magiquest" wands, speed controls, and I even added the ability to program the chip 'after the face' using EEPROM to respond to a different number on the IR remote control I had. So I could toggle specific models on and off, or turn all models on and off with different button -- but the actual programming on the ATTINY would be the same for them all.
9. Getting close, I now tackled my last problem. Power consumption. Up until this time I had been using the nice clean power from the board, and found that the coin battery I wanted to run this on couldn't supply the power so evenly, especially when I toggled the motor on. The noise from the DC motor would often interfere with the IR sensor so you wouldn't be able to turn it off. Adding a capacitor on the power source cleaned this up.
10. I wanted to be able to leave batteries in these models, but using a CR2012 only has 50mah in it. So any power consumption beyond a trickle would quickly kill the battery. The first thing I found was that my original design had the IR sensor being powered directly from the power source. This was a constant drain even when nothing was happening. So I moved the powersource for the IR sensor to an output pin of the ATTINY. This allowed me to programmatically turn the sensor on and off.
11. Even trying to be very conservative, the battery would not last more than a couple days if it was constantly checking for signals. The model is being used for a board game, and they typically last about 4 hours . So I decided after four hours, I'd have the ATTINY completely power down....and use a reed switch to be able to run a magnet by the model to reset the ATTINY and power it back up when we start a new game.
12. I noticed even in a completely powered down state, that the IR sensor was pulling 0.08mah when the ATTINY was sleeping. This doesn't seem like much, but when you only have 50mah battery life, that will drain it in about a month. This was driving me batty as I could not explain why it was draining the power.
13. I finally asked for help on this, and in asking for help, I realized the problem. (explain problems to other people is a great way of solving them. You end up seeing things you've overlooked). The documentation for the ATTINY says that when sleeping, you should set all unused pins to "INPUT_PULLUP" mode. It ensures they have a fixed state. I was also setting my used pins to INPUT_PULLUP as well. What I realized, is that INPUT_PULLUP ensures a positive bias on the pin, by connecting a 10k resistor from VCC to the pin. On my used pins though, this was letting a small amount of power trickle through to the IR sensor and the transistor. Once I changed that to be "INPUT" (which no longer would include the 10k resistor), the power trickle went away.
14. Then it was time to tweak my 3D models to make a little more room for the components, and go to work on assembling them. This was tedious and error prone. I have no experience putting something like this together and found it very frustrating. By the end though, I finally got all to work, and sealed up in the model, and I think my next project will be much much easier.
15. Enjoyed my new toy.
I will add some pictures and maybe a little demo after I have the model painted up. Thanks again everyone!
All in all, this process probably took about 60 hours to learn, design, and build the model -- but I feel much more confident going in to future projects and I'm very excited at the possibilities of using a MCU. While they are a little daunting at first, The possibilities and functions built in to those tiny little things is outstanding!
Last edited: