0

Currently I am working on a prototype project where I try to move a servo (6V) according to the level of light that is recognized by a photodiode making use of the ISR function. A torch light is used as the source of light.

First, I have built this project successfully making use of an arduino uno. After that in order to reduce the energy consumption I have made an Arduino on a breadboard making use of an atmega328 microcontroller adding sleep function using the jeeLib library. It worked well. Now I want to go to the next step with this project to design the prototype into a functional tool/device.

I was planning to customize an arduino and solder the servo (6V), photodiode etc.

I have researched to on this topic and read carefully the following link (How to go from newbie to manufactured?) and learned that creating a customized arduino might emerge to be an exhausting task; especially for a newbie to electronics like me.

At the same I am wondering whether there is a way to skip going through a PCB Fabrication. Now I came to learn that I might use an attiny 85 using a perfboard that can be used to program a servo and ISR function as well. Attiny 85 also consumes less energy.

Given the fact that I 'only' need to control a servo (6V) depending on the voltage going through a photodiode I do think that an attiny85 microcontroller might be a decent way to realize my project with less effort. I am aware of the little EEPROM and Flash size. However as already once in a discussion ( My Atmega328 seems to be overkill, what should I use instead?) apparently not all program that work with arduino uno will work with attiny 85.

Can you tell me whether there is a way for me to skip working with a pcb manufacturer to finalize my project? Is using an attiny 85 microcontroller a good alternative for my project?

Sathees
  • 125
  • 1
  • 3
  • 11
  • Adafruit trinket http://www.adafruit.com/products/1501 , does all the hard work for you and whatever 5V supply you use, your servo should actually still work fine with 5V. – KyranF May 14 '15 at 20:35
  • Another thing you can do to reduce power consumption is use a fixed sampling rate and put the device to sleep between sampling - if you sample at 40Hz for example, to get reasonable response time (you didn't say how fast it had to react to light sources) and the sample time itself is only ten milliseconds or maybe if you need to change output, 100ms, your overall power usage would be halved – KyranF May 14 '15 at 20:43
  • 1
    Is this the only device you're ever going to build? Learning to design and build PCBs is a valuable skill. – Nick Johnson May 14 '15 at 20:53
  • @KyranF Thanks for indicateing trinket..it looks interesting! Do you mean I shuold fix the sampling rate of the photodiode? – Sathees May 14 '15 at 20:58
  • How often are you moving the servo? I would think the power the microcontroller consumes is minuscule by comparison. – mng May 14 '15 at 20:59
  • @NickJohnson I am not sure whether this will be the only device..well as of now to finish this project within a reasonable time I would prefer to avoid designing the PCB... – Sathees May 14 '15 at 21:01
  • @mng The task of the servo is everytime a significant level of light is provided to move once 90 degrees to the right side after 2 sec of delay it is supposed to move 90 degrees to the left. I agree with you that the battery consumption of the servo is crucial. I was planning to make use of the ISR function; so that the servo only works if the photodiode passes its voltage from low to high....do you have a more advatageous suggestion? – Sathees May 14 '15 at 21:08
  • Sathees you can use software tricks like fixed sampling rates with "sleep" mode in between cycles and running at a lower clock frequency (you don't need 16Mhz for this!!) can save a lot of power. – KyranF May 15 '15 at 15:20
  • @KyranF thanks for the information. I was now planning to make use of adafruit trinket (runs at 8Mhz). I dont really understand what you mean with fixed sampling rate. Can you elaborate little bit? – Sathees May 15 '15 at 15:47
  • Sure. The program on your device does a procedure, which involves reading the light levels (ADC input), determining if that's enough to cause change in the servo, and then changing the servo if needed. This probably takes a few hundred microseconds at most, maybe a millisecond or two. What do you gain from having this process run at maximum speed? Nothing. Noise probably. BUT it reacts literally as fast as possible. If you can afford slower reaction times or possibly missing a "flash" of light, then you can design your program to do the above procedure at a known rate, and sleep between each. – KyranF May 15 '15 at 20:13
  • By using the sleep functionality on the AVRs you can reduce the power usage significantly, and it's very useful if you are only doing the same thing, over and over, at a fixed rate/interval. Check this guy's blog about sleeping the ATTiny85. http://www.re-innovation.co.uk/web12/index.php/en/blog-75/306-sleep-modes-on-attiny85 You will need to design your program around interrupts to cause a wake-up, or using the Watch Dog Timer to wake up the device after it does the check and goes to sleep again. – KyranF May 15 '15 at 20:22
  • Thanks KyranF! Is it really possible to influence the speed of the servo so that energy can be saved? I am aware of the sleeping function.I was planning to apply an ISR function using the photodiode. Only if the photodiode passes a certain level of voltage (change of a pin from low to high) the servo will be reactivated from its sleeping mode and it will move. Otherwise it will remain in sleepmode (it wont get any pvm signal). In that way I thought I save lots of energy. Do u agree with me? – Sathees May 15 '15 at 21:23

1 Answers1

1

An attiny will be fine for a single servo and adc sensor with the Arduino firmware. The things an attiny can't do that an atmega can has to do mostly with code space and amount of timers or interrupts. Your project is very small and not affected by this limitation.

As for developing a custom Arduino pcb, it's not that complicated. An Arduino is essentially just a breakout board for the microcontroller, with a regulator and usb to serial circuit attached, neither which are 100% required to be on board. Look at various bare bones Arduino which are no more than the microcontroller and a few passives.

Passerby
  • 72,580
  • 7
  • 90
  • 202
  • Thanks for the answer! I have two questions to that. 1. Attiny is however capable of handling interrupts, right? 2. As KyranF suggestet the Adafruit trinket might be an efficient solution for me. What do you think? – Sathees May 14 '15 at 21:51
  • Yes and yes. Ada is a great manufacturer – Passerby May 14 '15 at 22:17