Coder Social home page Coder Social logo

arduino-deep-sleep's Introduction

Arduino Deep Sleep & Bare Bones Arduino

How to put your Arduino to sleep to save power (and wake up again)

See the accompanying videos #115 & #116 at https://www.youtube.com/ralphbacon

(Direct link to part 1 video: https://youtu.be/jqFl8ydUzZM)
(Direct link to part 2 video: https://youtu.be/8fiYvnBDsDE)

Note: the video to actually construct the bare bones Arduino (using an ATmega328P chip and a handful of components) can be found in this GitHub repository under Bare Bones Arduino https://github.com/RalphBacon/Bare-Bones-Arduino, see YouTube video #117.

There are two ways to put your Arduino ATMEGA328P (UNO or Nano, for example) to sleep - or more accurately, two ways to wake it up after it has been put to sleep in order to save (battery) power.

So we have TWO sketches here: one to wake up using a switch (which triggers an INTERRUPT), and another to wake up every few seconds (8 seconds max) using an inbuilt TIMER.

They are very similar and I suggest you start with the interrupt driven one first (using two switches) as it's easier to get your head round what's actually going on!

It's all very well saving power by putting your ATMEGA328P board to sleep, but what are we going to do about the supporting circuitry? We cover that in part two by putting together a bare-bones Arduino using a handful of components. Easy to do and cheap.

Kickstarter campaign (not mine)

Also, have a look at Thijs Ruiter's Kickstarter campaign - if he reaches his goal I'll do a proper review of his sound module:
http://kck.st/2M2KeRr


The 18650 Battery Charge Shield:
https://www.aliexpress.com/item/ESP32-ESP32S-For-Wemos-For-Raspberry-Pi-18650-Battery-Charge-Shield-Board-V3-Micro-USB-Port/32870411748.html

The official ATmega28P data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega328_P%20AVR%20MCU%20with%20picoPower%20Technology%20Data%20Sheet%2040001984A.pdf

The FP6298 PWM converter datasheet:
http://www.feeling-tech.com.tw/km-master/ezcatfiles/cust/img/img/24/fp6298v063.pdf

Arduino pin mapping (GPIO numbers vs Chip numbers):
https://www.arduino.cc/en/Hacking/PinMapping168

If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so :)

My channel and blog are here:

https://www.youtube.com/RalphBacon
https://ralphbacon.blog

arduino-deep-sleep's People

Contributors

ralphbacon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

arduino-deep-sleep's Issues

Overwrite of WDTCSR

In this program: https://raw.githubusercontent.com/RalphBacon/Arduino-Deep-Sleep/master/Sleep_ATMEGA328P_Timer.ino, there is this code block:

	// clear various "reset" flags
	MCUSR = 0; 	// allow changes, disable reset
	WDTCSR = bit (WDCE) | bit(WDE); // set interrupt mode and an interval
	WDTCSR = bit (WDIE) | bit(WDP2) | bit(WDP1);
	wdt_reset();

The second setting of WDTCSR seems to overwrite the first setting. Could you explain this code block? What am I missing?

Thanks.

Peter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.