All day wearable
J W wrote 05/20/2016 at 19:42 • 2 pointsI'm trying to create a device that can work all day long and I'm trying to figure out what the best "computer" for the job. It needs to be able to run a bit of threaded code (preferably Java), have at least 3 input and 1 output pins, and run all day without being too big size-wise. I looked at the raspberry pi and arduino but they seem like they'd require a battery that's too big to wear all day unless there's some trick to getting them to use less power. I've never used either before. Any suggestions?
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Not sure what you are trying to do in detail, more info would help...but:
1. an android smartphone can run java and will have the battery life of a day if it is not loaded much + give you a ton of benefits. For input/output you can use bluetooth modules or USB I/O cards or event headphone jack.
2. for java on small devices have a look at http://www.espruino.com/ but I have no experience with it.
3. if you make compromises, on performance/programming languages, modern ARM microcontroller would be able to run for a day on even a coin cell battery even at 10s of MHz.
Are you sure? yes | no
oh, yeah. Also check mbed.
Are you sure? yes | no
Hey,
Just to be clear, you can not and will never be able to run Java on a microcontroller like Arduino or LaunchPad or ESP8266/NodeMCU.
You need something with an x86 or ARM-based Linux processor. This means Raspberry Pi, or Beaglebone, or Odroid C1 or any number of the competitor Single Board Computers.
Just from the ease-of-use and community support aspects, I recommend you pick up a Raspberry Pi 3 and try and get your code working on that before trying anything else. This will be the easiest and fastest way for you to get a minimum viable product, and then you can branch out to solutions that are more tailored for your application, later.
Are you sure? yes | no
yeah, it looks like c++ will be the best I can do with the Arduino. A person I'm working with is using a launchpad for their part so I might try using one of those eventually. I'm going to try to start with an arduino first though
Are you sure? yes | no
You may be interested in TI's LaunchPad boards. They are compatible with and similar to arduino, so they're fairly easy to start with. If you need really low power consumption, you can dig into the power-saving features of the MSP430 microcontroller.
Are you sure? yes | no
Are these boards a lot harder to use than the arduinos?
Are you sure? yes | no
I've never used one personally, but given that TI is pushing them as an alternative to the arduino, I'd assume that they're only slightly harder to use (due mostly to the much smaller community).
Are you sure? yes | no
The community is definitely smaller, so sometimes you can't find the perfect library that does everything you want, like Arduino, and online support isn't as varied, but it's a more professional chip interface, you have more options, particularly in turning stuff off, for energy efficiency, which could be good for you. It helps if you can do real embedded C. They have Energia, their processing-alike thing that tries to be easy, but I find it confusing. I would say just use CCS Cloud and real C.
Are you sure? yes | no
Most of modern MCUs can run at relatively low speed (say around 1MHz) while giving reasonable performance (refreshing displays, communicating with BT/GPS/GSM module, reading sensors etc.) and taking relatively small amount of power, say tens to hundreds of microamps at 3V. Power it from two AA and you are set for weeks or months of continuous use - I mean the CPU will be always on and running. If you employ some power saving features mentioned by @Radomir Dopieralski, like entering sleep modes or switching to lower operating frequency when possible, you can achieve even more or use smaller battery.
On the other hand, it is not fully featured computer with OS and bikini girl wallpaper, but somehow barebones hardware (closer to arduino than raspberry pi - you mentioned those before) where you can run your C code, or some dialect of python or lua in best case. It is up to you to determine whether you are OK with that. Nonetheless you can still do a lot of magic with it.
I have a few projects of low-power battery powered devices here, like #Microreader or #Pavapro - portable AVR programmer or #Micro progmeter or #Mini Altimeter. Perhaps it could be useful for you in some way.
Are you sure? yes | no
this actually sounds perfect for what I need: low power consumption, bit of processing power. I don't need to read from sensors faster than maybe 40 hz anyway. However, looking at your projects (which are pretty neat btw) it looks like they require custom pcbs and maybe some other advanced skills that I likely don't have. Since this is my first foray into the hardware side of things (I haven't even held a SBC before), it may be too advanced for me to use mcus unless there is some sort of starter kit where I don't have to etch my own boards. I'm hoping that from arriving in the mail to running a bit of code time is measured in hours and not days. Thanks for the suggestion!
Are you sure? yes | no
I understand. For starters, you can use Arduino - I think Arduino Uno is most common and you'll have the highest probability of finding tutorial or help on forums. I think it is by far the simplest way to enter door of MCU world, blinking the LED, communicating with PC or reading analog value in one evening.
From hardware point of view, the original Arduino with Atmega328 is nothing magical - just MCU with a few passives and USB/serial converter. The stripped down version (Arduino Mini) is really nothing but Atmega328 and passives on PCB. It takes a little bit lower power than full-blown Arduino Uno.
You can start your learning with Uno and once you'll be comfortable enough with your result, you can easily port it into Mini.
Now, regarding the power consumption - 8-bit AVRs are not the most power efficient MCUs, but it may be acceptable for you. Out-of-the box it runs at 16MHz at 5V, this means approximately 10-15mA consumption at 5V. If you power it from 5xAA (to achieve more then 7V at power input), you'll get approximately 5 days of continuous run time. Switching to AAA - about half of it. 9V battery gives you a few hours, perhaps half a day of run time.
If this is OK for you, awesome. If not, you'll have to dig more into it - and path to this land may be somehow crooked. Software can reduce current consumption by entering sleep mode with minimal consumption and wake up on demand. This brings average consumption down. Hardware tweaks include changing 16MHz crystal resonator for lower frequency (decreasing power consumption at active phase) and replacing the linear regulator for LDO type (decreasing low end of power input range, allowing deeper depletion of batteries or using 4xAA/AAA instead of 5xAA/AAA with the same result) are somehow more difficult for beginner - but you can employ it once you'll feel comfortable with basics.
There are already 3V variants of Arduino, but I'm really unsure about how well it is supported with all the hardware libraries, so beginner may suffer a bit. But 3V variant would allow you to power it from two AA/AAA cells (or single Li-Po with 3,3V regulator) - so we have already half the battery size - with even longer runtime, as the 3V variant run on 8MHz (half the speed, approximately half the consumption) by default.
TL;DR version - start with Arduino Uno, get familiar, switch to Arduino Mini, preferrable 3V version once you'll get advanced enough.
Are you sure? yes | no
jaromir, for some reason I can't reply to your comment. That was really helpful. I guess I'll pick up an uno and start playing around with it. Thank you!
Are you sure? yes | no
I don't know but have you looked at NODEMCU ? These little critters can use a lot less power than other devices and they have wifi built in. Are you thinking of an implant as well? I often thought that this would be good. Good luck. PJ
Are you sure? yes | no
that looks promising! I'd have to learn Lua but hopefully it's not to difficult. Their website is a bit sparse... I'll keep that in mind. Thanks
Are you sure? yes | no
Most of low-power devices achieve their low power consumption by sleeping most of the time, and only waking up sporadically to collect data and for user interaction. Modules like the ESP8266 have ridiculously low energy consumption in the deep sleep mode, and can wake up and go back to sleep quite fast. It all depends on what the device is supposed to do, though.
Are you sure? yes | no
Oh wow, that thing is pretty awesome.
I'm hoping there is someway to code it so that the code sits and waits for an input to go active before proceeding rather than running through a loop and checking the input's status on each go-around.
Thanks for the suggestion!
Are you sure? yes | no
you mean interrupts? There are no interrupts on pins for the deep sleep on an esp8266 but otherwise they can be used.
Are you sure? yes | no
I'm not sure if that is what I'm referring to.... I've never worked with hardware before, only the software end. I'm hoping I can write code like When pin1=high then blahblah. That way the device can sit on that line and save battery and only kick on when there's action. Not sure if that is what an interrupt does or not.
Are you sure? yes | no
Assuming you're not pinning your processor the whole time, you can estimate that a RasPi Zero will average less than 500mA at 5V.
Take a pretty bog-standard portable cellphone charger:
http://www.aliexpress.com/wholesale?SearchText=cell+phone+portable+charger
And the numbers seem to be anywhere from 3000 to 20,000 mAH. At 3000mAH, you've got 6 hours right there.
To be honest, I wouldn't trust the capacity to be any more than half the claimed values on AliExpress, but the larger ones should still have more than enough juice.
Are you sure? yes | no