Alternative Power Sources for the Spark Core

Hi Spark Community,
This thread is dedicated to providing and discussing information on alternative power sources for the Spark Core. Although using the built for spark battery shield is recommended, some projects and hobbyists are better served by alternative products that are more compact, conservative, etc. Please use this thread to discuss any such products that you have found helpful in powering your projects, giving as many essential details as you can (cost, recharge time, battery life, etc). Thanks all for continuing to be awesome Sparkans! :smile:

1 Like

The_Anthony, a lot has been discussed in this topic started by timb. You may find all your answers there including details on timb’s upcoming NEW battery shield with battery charging and solar input. :smile:

1 Like

One solution I used this past week was a Powerocks Magicstick:

I think I got it as a freebie at some conference but Amazon sells them. I am using it to power my ‘Internet of Things Physical Like Machine’ aka a wireless candy dispenser. I needed a stand-alone power source that fit into a CD-R spindle/case. You can just see the Magistick on the bottom level of this photo:

It seems to successfully power the Sparkcore, the motor relay and dispensing motor itself long enough for table top demos. The relay requires 5 volts so it connected that to the VIN pin.

OT question - is powering a small, 5V sealed relay from the VIN pin dangerous to the SparkCore itself? Nothing bad has happened for several days but am I running the risk of bricking my Core?

Hi @longarc

I don’t think the danger from the relay is due to the voltage per se, but driving relays (or other inductive elements) is tricky because when you stop driving them they try to continue with the current they had flowing when you were driving them and this can lead to voltage spikes. That is why relay drivers normally have a diode across the coil going “backwards” so that these voltage spikes don’t harm the circuit driving the relay. Here’s a schematic I found online–the 1N4001 is the diode.

http://forum.allaboutcircuits.com/cache.php?url=http://home.att.net/~Tom.Horsley/phonetale/relay.jpg

If this is how you are driving your relay, you will be fine.

I had been talking to @The_Anthony on Twitter a bit about this, based on a little remote temperature sensor that I had made with my Spark. I used this:

http://www.amazon.com/gp/product/B00BFY59BA/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1

I previously had it (and still use it for) charging my cell phone when away from home for extended periods of time. It’ll drive a spark reading a tmp36 temperature sensor every 30 seconds and echoing the computed temp to a UDP port on the local network for about eight hours.

Related - does anyone know if there are any techniques to decrease power consumption?

@pthread,

There’s a few main factors for power consumption (some are general)

  1. Speed of the processor.

:spark: core is on 72Mhz. Going lower reduces power consumption but up till a certain Mhz you will have issues with delay() etc. Mainly those stuff using clock signal.

As long as you know what to be tweaked, you can still get stuff running! I used to do that to save power on my project which needs to stay outdoor for weeks and not doing intensive stuff.

Changing all this requires local compiling for now though…

  1. Wifi tx/rx

The main bulk of power consumption comes from the Wifi module. Like 200-300ma during active connections

If you don’t need instant monitoring (sounds weird for temperature monitoring), you can turn of the Wifi and only connect once every few XXX and transmit one shot. Something like 30mins and above intervals would be nice or you end up using more power turning on and off the Wifi module.

  1. External devices

If you’re only having the temp sensor then there’s probably nothing irrelevant to be removed

  1. RGB led status

Never underestimate the leds! They use up power quietly… Use the Spark functions to get em turned off and on it using code occasionally to check on the status. Or just use D7 as the indicator (blink, fast blink, X number of blink etc)

Have fun! :smiley:

2 Likes

pthread, you may wan to look at this topic:

To save power, the idea is to sleep between read/send activities. So you read the temperature, open a UDP port, send your data, close the port and go to sleep for 30 seconds. After 30s, the Spark wakes up and the process starts over. During sleeps, the power consumption drops to below 20ma so that should extend your power considerably. :smile:

2 Likes

Wow thanks so much (also @peekay123 below!). Both amazing responses!

I just got back from a climbing trip and wished that i had a GoPro to video the journey + a :spark: core logging the entire route i took and the pressure…temperature…etc.etc…

Time to prepare before my next adventure…

Gah! :smiley:

How do I turn wifi off. My code is interrupt driven and my cite contacts a server when an event happens. So I don’t need wifi when no event has been triggered.

Thanks,

To turn off Wifi and/or Spark.connection at startup:

#include “application.h”
#include “spark_disable_wlan.h”
#include “spark_disable_cloud.h”

To turn Wifi on/off in your loop():

WiFi.on();
WiFi.off();

To check Wifi status:

WiFi_Status_TypeDef current_wifi_status = WiFi.status(); //save in current_wifi_status

The conditions available for WiFi.status()

WIFI_CONNECTING
WIFI_ON
WIFI_OFF

To connect to Spark.cloud on/off in your loop():

Spark.connect();
Spark.disconnect();

2 Likes

Perfect. Thanks much for the reply. Is this documented somewhere. I wonder what else I’m missing …

Not really in the official docs yet but yeah…

Hi @rawmean,

This way of connecting and disconnecting is under active development by the Spark team so they are going slow on doc’ing this. The concepts are the same, but the names are likely to change in the future and they didn’t want to put this in the doc and deprecate it a few weeks later.

Hey @kennethlimcp, I’m trying to turn wifi on and off in my code but the spark build doesn’t compile the WiFi.on() method, any ideas?