Search This Blog

Monday 15 August 2016

3D Printing: First Object Success!!

As much as I would like to build one of these printers, just because it's neat, we thought we should learn more about process and uses first. A couple of visits to the HPL MakerSpace convinced us to start there. So I decided to print a solar panel holder for Roz' Little Library (to charge the batteries that run it's computer, of course!). Several days of learning and working with TinkerCAD design tool produced a very nice design, so I registered with the Library, and scheduled a couple of hours last night on one of their MakerBot Replicator 3D Printers. We are very pleased with the outcome, and will certainly try more. Total print time: 1 hour 45 minutes. Total cost: $1.90 .


The TinkerCad Design image
Printed frame with solar panel and wiring installed.



Printing underway, on the MakerBot Replicator+ at the HPL MakerSpace. Frame is printed upside down.

Sunday 14 August 2016

Arduino on Battery...

I've thoroughly enjoyed learning about, and using, small Arduino microcomputers.
My collection includes Nano's (5V, 16MHz, USB, Volt Reg, 328P, china clones) and Micro Pro's (both 3.3V and 5V versions, china clones).

But it is important to find applications for them.  A Little Library became an interest in our family when the grandkids discovered one in their neighbourhood, so we are soon to have one on our lawn.  It seemed reasonable to add a little light to the library to make it easier to use in the evenings, so a small battery powered, solar panel charged light was obtained for this purpose.  Seemed an excellent device; the lamp looks good, offers the equivalent of a 15W bulb at about 150mA, and has an 800mAh LiIon cell to run it.  The included little solar panel (3 x 5 inch) was naked, but a simple 3D printed holder took care of that (another story...)

But the light needed to come on only when the little doors to the library are open, and it is probably a good idea to add a little timer to check if the doors are left open, and turn off the the light to save the battery.  And we don't need to turn on the light if it is daylight outside, right?  And, since we added those little door switches, we should probably keep track of how busy our Little Library is...  And maybe we should report some this data, along with monitoring the battery charging and voltage, somewhere more convenient, perhaps with a radio data link....  So now we have progressed a long way from the little power switch that comes with the original light system...

Wow!! An excellent application for a little Arduino and a few other goodies!!

The interesting catch here is that the Little Library sits at the edge of the street, far away from the usual power sources.  But an Arduino doesn't use much power, and the solar panel should keep that little battery charged; it says so right in the marketing literature.  So we proceeded to build a little interface, to hold a Nano, and some interface circuitry to read switches and voltages, and control the light, and connect to a nice little data radio system running at 2.4GHz. We also added a couple of voltage regulators; a 5V Booster to ensure 5V to the Nano, and a 3.3V regulator to ensure good voltage to the radio.  We got most everything working, then thought it might be useful to take some measurements.  It's not wise to run a LiIon cell down too low, after all...

Well, the electronics I added, minus the radio, draws about 40mA, and if the sun isn't out, the solar panel only supplies about 5mA charge current!!  And the lamp isn't even on yet!!  More work needs to be done!

There is a lot of information available online concerning the use of the Atmel 328P low power, or Sleep modes, and a number of very good Arduino IDE Libraries exist to make it easy to use them.  One confusing aspect of some of the Sleep modes seems to be how long it takes for the 328P uC to Wake Up after being in Sleep mode.  Not a lot of info available, and what there is seems unclear.  Suggestions range from a uS to 65mS+!!!.  Since I am running some contact debounce and voltage filtering logic on a time base presently set to 5mS, It is important to know what is really happening. So I did a little testing, to determine this, and also to see what power savings were possible with my Nano, even though the USB and V Regulator chips have no sleep mode.

The test routine I used is very simple:

#include <Sleep_n0m1.h>
//  Test startup delay for various sleep modes.
// Use Sleep_n0m1  to provide 15mS sleep periods, set, then reset an output bit, then loop.
// measure sleep interval with scope...
Sleep sleep;
unsigned long sleepTime; //how long you want the arduino to sleep
void setup() {
   sleepTime = 15; //set sleep time in ms, max sleep time is 49.7 days
    pinMode(6, OUTPUT);  // pulse to monitor sleep time.
    digitalWrite(6, 0);  // ensure bit is off to start   
}
void loop() {
/* modes of sleep
   SLEEP_MODE_IDLE
   SLEEP_MODE_ADC
   SLEEP_MODE_PWR_SAVE
   SLEEP_MODE_EXT_STANDBY
   SLEEP_MODE_STANDBY
   SLEEP_MODE_PWR_DOWN
   */
  sleep.pwrDownMode(); //set sleep mode
  sleep.sleepDelay(sleepTime); //sleep for: sleepTime  (use delay(15) instead when not sleeping)
//  sleep ends here.  Pulse output bit quickly (about 4uS)
digitalWrite(6, 1);
digitalWrite(6, 0);
}

With this and my scope (Hantek 6022BE DSO), and a meter to measure current draw to the Nano, I got some very interesting results, which might be of use to others:

Sleep Mode:                Loop Time:    mA @ 5V:     mA @ 4.2V
None [use Delay(19)]   19.0mS            21.6                13.5
Idle                               19.0mS           13.7                  8.4
Standby                        18.9mS            7.0                   5.4
Power Down                 19.9mS           6.6                   5.1

Notes:
- Loop time differences of 18.9 vs 19.0 prob. due to accuracy of cursor readings on my DSO
- Power Down mode saves a bit more power, but adds 1.0mS to wake up times
- supply V = 4.2V was also tested, to estimate savings on direct LiIon cell voltage
- Loop time was unchanged when supply V changed.
- using a nominal sleep duration of 15mS on this particular Nano results in almost 19mS of actual sleep time. Since my reading suggests that other sleep mode wake up times, due to hardware, are very very small, this must be due to a substantially different WDT oscillator frequency, which was not affected by supply V.
- the data above suggests that the 328P in the Nano is configured for a "Full Swing Crystal Oscillator Clock", which prevents the CPU from running for 16K clock cycles after startup of the oscillator.  At 16MHz, this will be about 1mS, the added amount in the Power Down sleep mode.
- the no sleep mode case used a Delay function, set to match the sleep loop times, instead of a Sleep function.

A Mini Pro, running at 3.3V would allow additional savings, prob. under 1mA average consumption.  However, since my Library electronics includes a socket for a Nano, and the Mini Pro pinout is substantially different from a Nano, I will operate with the Nano, at 4.2V for a while.  If an additional power savings is needed, I can rewire the electronics to accept a Mini Pro.  I can also remove the 5V Booster (uses about 3mA idling, not included in these measurements ), and look at shutting off the 3.3V Regulator (another 3mA idling), if needed.

Hopefully real world edge of road install tests will show much higher solar panel charge currents on average, and worst case, sufficient to provide enough charge during the day to run the electronics for a 24 hr period...

Now back to my code rewrites, since the millisecond function, and the Bounce2 and SimpleTimer Libraries that depend on it, will no longer work in the Low Power Sleep World...



Saturday 13 August 2016

MS Mail confusion...

Email is an important part of our ability to communicate, stay in touch, do business, and more.  So it would seem that MS would provide stable, functional email clients for it's Windows OS, no?  Although I am comfortable with Linux and Android variants (among others), my everyday desktop PC is Windows based.  I am a fan of client email apps, partly to allow me some control over storage and back-up of enduring email threads.  Maybe it's my IT background, but I don't have complete confidence in "the cloud" to look after the security and privacy of everything.

In the beginning of my GUI-based email experience, there was Outlook Express.  A reasonable email client, and worked in a similar manner to the work-based full Outlook.  It ran for a long time, but then there was warnings of EOL, and occasional problems, and new problems, and many encouragements from MS to switch.  The client du jour was Windows Live Mail.  After some checking and testing, I switched.  Eventually, it worked in an acceptable manner, although not without lots of issues along the way.  But it had been stable for several years, and we had learned to get along.

Wash rinse, repeat...  Troubles started to appear with Live email.  Lost emails, synch problems, strange freezes, the need to restart the app, or the OS...  The warnings about EOL started to appear.  The switch to WIN10 didn't help.  The many encouragements from MS to switch again began, this time to Windows Mail, included with WIN10.  I resisted the approach for a while, but finally decided anything would be better than the Live Email problems.  So after doing some due diligence on this new Mail program, I switched....

Initially, it looked like just another learning curve.  What was wrong with the last mail user interface, that MS decided I had to experience a completely different one, not intuitive at all?  And, btw, what happened to that local storage method I liked so much?  Seems the only easy solution (??) was to move all those local nicely categorized emails back out to an email server!!

So I gradually got used to doing things the 'new' way, and we developed a moderately comfortable existence.

Then I discovered "Auto Capitalization"!!!  (something sent as all lower case, that needed to be used that way, got Capitalized!)  wtf?  I didn't ask for this, no other email client ever did this, and, afaik, there is no way to turn it off!!  (the suggestions in various blogs don't work, and a LOT of people are asking how....)

MS, you need to step up your act a bit here...