Let's use the Makerverse Nano Power Timer and a Raspberry Pi Pico to create a low-power datalogger. The power timer cycles power to the Pico - greatly extending the life of our batteries!

Transcript

G'day and welcome to the guide video for the Makerverse Nano Power Timer. This module will periodically switch on a load such as a microcontroller, and in this video we'll be using it to make a low-power data logger with a Raspberry Pi Pico. While most microcontrollers will run off batteries for hours or days, the Nano Power Timer can push this out to days or weeks or even months. It does this by completely powering off the microcontroller when not in use, and periodically switching it back on again.

Let's get started with the guide. Power is connected to the Nano Power Timer either via a battery connector or a 2.54mm pin header, and it will then periodically switch on two output power pins in order to enable a microcontroller to switch on, sample some data, record it to a file, and then tell the Nano Power Timer that it can be switched off. The DNE input pin on the Nano Power Timer will switch off the microcontroller when a high signal is received. The row of dip switches on the Nano Power Timer set the delay between microcontroller power-ons. The time delay set for each individual dip switch is written on the back of the Nano Power Timer, or you can check out the guide for the full list of different combinations that you can achieve.

For this example, we're going to switch on every switch between A and E, and that will set a 2.2 second period. Let's get started building the actual data logger. We have a Raspberry Pi Pico on a breadboard, and a potentiometer connected to one of its ADC pins. The data logger will measure the voltage on this ADC and write it to a log file. In order to do the wiring for this project, we need to make four connections. Firstly, we'll do a connection from the Nano Power Timer's minus out pin to the ground pin on the Raspberry Pi Pico. Next, we're going to make a connection from the out plus pin to turn it up and we'll see the light on the Nano Power Timer flash.

We will start by connecting the V-SYS pin on the Raspberry Pi Pico to the next connection, the DNE or done pin. This connection is from GP15 on the Raspberry Pi Pico to the DNE input on the Nano Power Timer. Lastly, we will connect a three AAA battery pack to the battery connector on the Nano Power Timer.

To get our code onto the Raspberry Pi Pico, we will connect a micro USB connector to a PC and then load the code onto it through Thonny. If you are unfamiliar with Thonny, we have a guide to help you program a Raspberry Pi Pico. Inside Thonny, we will paste our code from the guide and save it as main.py. This is important because this is the file that is run automatically when the Raspberry Pi Pico is switched on.

The code we are using imports the pin and ADC modules, then defines the done pin so that the Raspberry Pi Pico can tell the Nano Power Timer that it is finished writing data and can be switched off. We also define our analog to digital converter. We take an analog to digital converter reading, and then this code opens up a file on the Raspberry Pi Pico's file system, writes our ADC reading, writes a new line, and then does a flush and a close. The flush and the close are there to make sure that all of the data is written to the file before the next line of code turns on the done pin and hard powers off the Raspberry Pi Pico.

Now that main.py is saved to the Raspberry Pi Pico, we can unplug it, switch on the battery, and we will see the Nano Power Timer's light periodically flash. We can turn the potentiometer all the way down and then slowly turn it up and we will see the light on the Nano Power Timer flash.

Turn it up and we will see this data change in the log file. Now that we've had the logger running for a while, I'm going to turn the battery off, plug it back into the PC, and open up the log file to see what we've got. With Thonny back open, we can press the stop button to reconnect to the Pico, then we'll see log.txt in the file list. Double clicking this will open it and we can see all the ADC samples that have been recorded. Towards the bottom of the log we see a zero, then a six thousand, then slowly back up to the maximum value. These data points were recorded as the potentiometer was being rotated.

We hope that this simple project has given you some great ideas for your own projects. If you make something cool or just have a question, please leave a comment on the article for this video.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.