By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Allendale Jan 24th

Arduino low power alternatives

All Topics | Latest Posts

Search for:  in Thread Title in  
John Haine08/08/2020 11:08:36
3270 forum posts
175 photos

Thanks Joe - there are a couple of pics of my first clock in my albums, one before it was cased the other in its case (but with a horrid reflection in the door window).

SillyOldDuffer08/08/2020 13:07:07
Moderator
6186 forum posts
1345 photos

As a next step, I suggest tabulating the design requirement. (Andrew mentioned the importance of the overall design early on.) In particular inputs and outputs.

Before setting up a bare board or attacking a Nano with bolt cutters it's best to understanding what the circuit and external hardware must do, designing software & hardware together to minimise power consumption. Leaving out the power LED is obvious and safe, but other notions need a little thought. For example, bad ideas might include:

  • Removing the USB chip when the design needs a USB interface
  • Removing the USB chip on a Nano when the design depends on it as a 3V3 power source
  • Disabling ADC when the design requires an analogue input
  • Disabling SPI when the external hardware has an SPI module
  • Disabling Timer1 when the software depends on millis()
  • Using outputs to drive power hungry hardware, especially continuous loads.
  • Ignoring PULL_UP & PULL_DOWN power implications when designing external hardware.
  • Dropping clock speed when the software task is time critical.
  • Stopping clocks to save power when fast reaction to interrupts or wake-ups is needed

I emphasise might because it all depends on the application. A simple switching application could be easy to power save; other code may be tricky! An Arduino advantage is it comes with all this stuff switched on and the processor is in a safe configuration. Beginner programmers don't need to worry about particulars, great except ease of use wastes power. Programmers who shave microamps become responsible for managing gory under-the-bonnet detail, which can be advanced stuff.

All do-able though, and interesting. Please keep us posted. I'm sure someone will help if you get bogged down in an unexpected complexity.

Dave

Edited By SillyOldDuffer on 08/08/2020 13:07:54

Versaboss08/08/2020 14:39:05
455 forum posts
51 photos
Posted by Andy Stopford on 07/08/2020 20:53:10:

Lastly, do yourself a favour and ditch the Arduino IDE - there are much better, easier to use alternatives, with full code completion, hints, colour coding, etc.

I use PlatformIO; it's available as a code editor plugin. I like the Atom editor, but you can use it with VSCode, and, possibly, others.

Hi Andy,

as a sometimes Arduino user I'm always interested in such stuff. However, all is not so easy. I managed to install the Atom editor, and then tried in vain to cooperate it with PlatformIO. What I now have, if I start Atom, is a black screen with a menu bar. There is also a menu point for PlatformIO. But after say a minute I get the message 'editor isnot responding.
I deleted Atom and re-installed it, with the same result.
And btw, IF that system would work, how could one compile the code and load it up into an Arduino? Copy/Paste to the Arduino IDE?

Regards,
Hans

Andy Stopford08/08/2020 20:20:21
36 forum posts
1 photos

#####################

Posted by Joseph Noci 1 on 08/08/2020 08:21:54:Posted by Andy Stopford on 07/08/2020 20:53:10:

Just a couple of points:

********************.....

Lastly, do yourself a favour and ditch the Arduino IDE - there are much better, easier to use alternatives, with full code completion, hints, colour coding, etc.

I use PlatformIO; it's available as a code editor plugin. I like the Atom editor, but you can use it with VSCode, and, possibly, others.

I just spent near 2 hours digging into 'PlatformIO'...I think its a little presumptuous to just tell folk to 'ditch' the Arduino IDE...

....

In the two hours I could not fine what the minimum software overhead is when running this system on 'my' board - is there a bootloader? What size is it typically? How does it affect run-time measurements?..

####################

Steady on Joe, I'm just venturing my own opinion; people are free to make of it what they want. You will find many complaints regarding the Arduino IDE in the Arduino forums. It does not make life easy for the beginner, which surely is the point (and was my own experience when I first got an Uno).

As it happens, I totally agree with you regarding the PlatformIO website. It's a model of corporate BS which seems designed show how much money they can afford to waste on some wacky web developer with a mission to put interested punters off.

However to make it clear - it is just an IDE, like the Arduino one, but with some bells and whistles to make it easier and more convenient to use. It doesn't run on your board, it doesn't have a bootloader, though it could be used to install one in conjunction with one of the Nick Gammon scripts I linked to.

Andy Stopford08/08/2020 20:35:34
36 forum posts
1 photos
Posted by Versaboss on 08/08/2020 14:39:05:
Posted by Andy Stopford on 07/08/2020 20:53:10:

Lastly, do yourself a favour and ditch the Arduino IDE - there are much better, easier to use alternatives, with full code completion, hints, colour coding, etc.

I use PlatformIO; it's available as a code editor plugin. I like the Atom editor, but you can use it with VSCode, and, possibly, others.

Hi Andy,

as a sometimes Arduino user I'm always interested in such stuff. However, all is not so easy. I managed to install the Atom editor, and then tried in vain to cooperate it with PlatformIO. What I now have, if I start Atom, is a black screen with a menu bar. There is also a menu point for PlatformIO. But after say a minute I get the message 'editor isnot responding.
I deleted Atom and re-installed it, with the same result.
And btw, IF that system would work, how could one compile the code and load it up into an Arduino? Copy/Paste to the Arduino IDE?

Regards,
Hans

Hi Hans,

It looks like there might be a problem with the latest version of Atom (always a possibility with actively developed Open Source stuff), see this thread:

https://github.com/platformio/platformio-atom-ide/issues/2377

As suggested in the 3rd to last post there, it might be better to use the VS Code version, which being a Microsoft product, is likely to be more reliable than Atom. I shall have to look into that.

Anyway, in either case, it will compile and upload your code in the same way as the Arduino IDE, and it has a Serial window which you can read, interact with, etc if required, again like the Arduino one.

SillyOldDuffer08/08/2020 22:17:07
Moderator
6186 forum posts
1345 photos
Posted by Andy Stopford on 08/08/2020 20:35:34:
Posted by Versaboss on 08/08/2020 14:39:05:
Posted by Andy Stopford on 07/08/2020 20:53:10:

Lastly, do yourself a favour and ditch the Arduino IDE - there are much better, easier to use alternatives, with full code completion, hints, colour coding, etc.

I use PlatformIO; it's available as a code editor plugin. I like the Atom editor, but you can use it with VSCode, and, possibly, others.

Hi Andy,

as a sometimes Arduino user I'm always interested in such stuff. However, all is not so easy. I managed to install the Atom editor, and then tried in vain to cooperate it with PlatformIO. What I now have, if I start Atom, is a black screen with a menu bar. There is also a menu point for PlatformIO. But after say a minute I get the message 'editor isnot responding.
I deleted Atom and re-installed it, with the same result.
And btw, IF that system would work, how could one compile the code and load it up into an Arduino? Copy/Paste to the Arduino IDE?

Regards,
Hans

Hi Hans,

It looks like there might be a problem with the latest version of Atom (always a possibility with actively developed Open Source stuff), see this thread:

https://github.com/platformio/platformio-atom-ide/issues/2377

As suggested in the 3rd to last post there, it might be better to use the VS Code version, which being a Microsoft product, is likely to be more reliable than Atom. I shall have to look into that.

Anyway, in either case, it will compile and upload your code in the same way as the Arduino IDE, and it has a Serial window which you can read, interact with, etc if required, again like the Arduino one.

Like Hans I've tried PlatformIO and run into the same problem. Not easy to set up is it? The advantage appears to be support of multiple Frameworks and Boards from a common IDE, but it's a steep learning curve particularly when installation fouls up.

I went through the list of supported editors looking for one I liked. Unfortunately none of my favourites are there apart from vim, not my first choice for an IDE. Anyway atom is respectable, and it would make installing PlatformIO easy - except it's broken. Tried a couple of other editors but they lack the IDE integration offered by atom, and presumably vscode. As linux is my preferred platform I'm not keen to add a Microsoft editor! Or to learn Eclipse, Netbeans or one of the other big alternatives. The Platform.IO CLI works in so far as I've tested it, but it's not a beginner tool,

The Arduino editor may not be the most advanced, but it works and is straightforward to learn. The IDE is workmanlike rather than spectacular but it organises boards and libraries in a fairly obvious way and makes uploading easy too. For most simple purposes it's fine.

I'm not finding PlatformIO's documentation easy to penetrate. For example, what happens if I want to program a Nucleo? The documentation mentions a 'Bare Metal Proflle', a subset of the OS6 RTOS. I guess from the outline of JSON configuration details that full mbed can be set up and configured but I'm finding it hard work compared with both Arduino IDE and MStudio. Not clear how much is built-in and how much has to be configured.

I've not spotted a 'must have' reason to change so far. Not given up yet - I'll try vscode tomorrow. Advantages may appear when I get to compiling and uploading. For example my current project runs on both Arduino and Nucleo, with the Nucleo version based on a copy. Be nice to write and manage both as a single project, but I don't imagine many beginners are into that kind of code management.

Dave

IanT09/08/2020 15:36:39
1581 forum posts
145 photos
Posted by Bazyle on 06/08/2020 12:31:28:

Not certain but I think these processors are designed to run on 3.3v because it is available from batteries without using a regulator.

Although not the same IDE, in fact does not need an IDE and is programmed in Basic, the Micromite is designed with low power features including sleep and clock slowing specifically for running off batteries.

I am a big fan of Micromites and as Bazyle says - they can be programmed to run at a (battery saving) slower speed or simply put to sleep - all under programme control. The 28pin PIC32 chip only needs an external capacitor to give you a complete working system programmable in MM Basic - the PIC32 chip required is under £4.00 - the s/w being free to download.

At full wack (48Mhz) the '170 ' chip will typically be drawing just over 30mA but you can programme the CPU clock speed and at 5Mhz the current draw is about 6mA.

You can also tell the system to "sleep" for a number of seconds or to go to sleep but monitor the "wakeup" pin - the current draw will then fall to about 100 micro amps. So for battery-powered embedded systems, Mites are very useful little creatures.

Micromite Basic has been ported to other systems - and if low power consumption but with more 'grunt' is required - the 'Armmite F4' based on the STM32F407VET6 board would be worth looking at. You can purchase these STM boards for about £12 and they have a fast ARM Cortex chip with more memory & I/O.

So whilst Arduino is very popular, there are very good (but lesser known) alternatives and the Micromite family is one of the best for embedded solutions in my view.

Regards,

IanT

SillyOldDuffer09/08/2020 16:28:57
Moderator
6186 forum posts
1345 photos

Final report on PlatformIO which I have working on Ubuntu 20.04! Took a couple of hours to sort out install glitches:

  • vscode deb package fails
  • two snap packages, of which the Microsoft one renames vscode as code. Both loaded PlatformIO as an Extension, but I reinstalled with Microsoft to get the latest version. Slight confusion, it's called 'code' rather than 'vscode'
  • Importing an existing Arduino project worked except:
    • Didn't find the two contributed libraries I'm using. After flapping around false clues about includepath and vcpkg, turns out contributed libraries have to be imported manually. Not difficult when you know how, but bothersome compared with Arduino IDE. PlatformIO copes with libraries for multiple boards, if needed, but it's more cluttered than Arduino's "me-only"
    • Intellisense (the code completion module) balks at Arduino's .ino suffix so I followed instructions and saved as .cpp
    • Although Intellisense asked for a rename, PlatformIO automatically added .cpp to the old ino name, and complied both causing a shower of duplicate symbol link errors. Fortunately I recognised the symptoms, and sussed out how to delete the unwanted file.
    • Upload failed with an avrdude error which I recognised as due to a Nano peculiarity. Some are sold with 'old bootloader', others with 'new'. Fixed fairly quickly by reconfiguring the project, after which upload success!
    • Activating the monitor got me no-where though because it was set to 9600 rather than 57600 baud. Took ages to find speed isn't set from the IDE; it has to be edited in the PlatformIO.ini configuration file.

Conclusions. I can see why Andy likes PlatformIO but it isn't a beginner tool. Too many advanced options. vscode and platformio are both fairly intuitive, but suffer from a surfeit of choices. The software is generous with warnings, errors, hints and popups, just what an experienced programmer needs when hunting down awkward problems, but likely confusing noise for a beginner happy to have the editor jump to his suspicious code. An old conundrum: should a development tool give the programmer the full gen, or should it hide details because most of them are irrelevant? I prefer the latter, only looking at gory details when necessary.

Good stuff - being able to put projects into github, code checking and support for boards galore, plus ability to add you own. Code checking, ie highlighting issues that don't cause compile failures, might lead the beginner astray. Tells me correctly that atomicElementTime can be reduced in scope, but incorrectly flags functions setup() and loop() as unused. Trouble is they are!

My approach to software development varies. I quite often use vim, make and the command line as if it were still 1980. kate (or geany) are much used as a sort of semiautomatic-IDE for C,C++ and Python projects. The Arduino-IDE is great for Arduino, less satisfactory for some other boards. idle is good for small Python projects. For mbed I've experimented with Cloud, MStudio, and command line approaches. At the moment MStudio is ahead on points! I don't care much for full IDEs like Netbeans or Eclipse because they're over the top for what I do.

If I could only have one approach on a Desert Island it would be the old-fashioned command line tools because they can do everything! But they ain't easy to learn or use - most of the time simple projects are best done with simple tools. Learn to fly in a Tiger Moth, not a Jumbo Jet

Meanwhile, I shall explore PlatformIO further. I've certainly not rejected it.

Dave

Andy Stopford09/08/2020 20:24:51
36 forum posts
1 photos

@SOD

Atom/PlatformIO seems to work now if upgraded to version 1.49.0. Mine wasn't set up to automatically update and was still on V 1.39. I used the method shown on this page:

https://flight-manual.atom.io/getting-started/sections/installing-atom/

And followed the instructions to add the repo for my OS (OpenSuse 15.1).

I've had another look at (VS-) Code, and I think Atom is more user-friendly (or at least less user-hostile).

It's a tricky one, simplicity v. all-singing, all-dancing complete solution. Much of the time I think poor documentation is the problem, as you've mentioned.

Of course, in the world of 'real', physical devices, simple isn't necessarily easier; my first lathe was one of these*:

https://store.lathes.co.uk/adverts/for-sale/antique-brown-brothers-lathe

It's a lathe, it turns, faces and screwcuts, but with no graduated dials, thread-dial indicator, on-off switch(!), etc., it wasn't exactly an ideal beginner's machine. Character-building, you might say.

* If the link disappears, it's a rather agricultural flat-belt driven machine by Brown Brothers of Great Eastern St., EC, dating from around 1900(?). Mine didn't have the power cross feed, countershaft or most of the other accessories.

duncan webster09/08/2020 20:35:13
avatar
2734 forum posts
40 photos

Well off topic!

I can go older than that lathe. When I first worked on R&ER the lathe used for turning wheels was a real relic, it had been donated to the R&E by the GWR in the early 1920s (they had a director in common, Sir Aubrey Brocklebank). It didn't have a cross slide as such, more like a double decker topslide. Not over good for big facing cuts, but OK for wheels.

When the time came to pension it off it was offered to MOSI and Science Museum but neither would pay for transport so it was weighed in

Edited By duncan webster on 09/08/2020 20:35:47

IanT09/08/2020 20:53:51
1581 forum posts
145 photos

I think you've just summarised very well why I don't use anything this complicated SoD.

I'm not a professional programmer and never will be. These things might suit someone with the right background but I don't have the time to spare. Simple suits me better.

smiley

Regards,

IanT

SillyOldDuffer10/08/2020 08:17:14
Moderator
6186 forum posts
1345 photos
Posted by Andy Stopford on 09/08/2020 20:24:51:

@SOD

Atom/PlatformIO seems to work now if upgraded to version 1.49.0. Mine wasn't set up to automatically update and was still on V 1.39. I used the method shown on this page:

,,,

Not on my machine! I'm on Ubuntu 20.02 and "sudo snap install atom --classic" installs 1.49.0

Atom works as expected and other extensions load correctly - just PlatformIO that crashes. Probably a temporary glitch in the package.

I like Atom's clean look and feel, but it's main selling point isn't for me at the moment. It's integrated with git, perhaps the best way of sharing & developing version controlled code in collaboration. But I'm a singleton programmer, occasionally sharing code on a small scale with Forum friends, so github's advantages are wasted on me.

General point about choosing tools is understanding they all have advantages and limitations. I find the Arduino IDE well suited to simple 'just me' microcontroller projects, but professionals would likely need more control, especially if they're a team! PlatformIO is in that class. Thanks for mentioning it.

Dave

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Latest Forum Posts
Support Our Partners
Warco
cowells
ChesterUK
emcomachinetools
EngineDIY
Eccentric July 5 2018
Eccentric Engineering
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest