CPX and datalogger extension and battery power

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bblakey
 
Posts: 8
Joined: Thu May 25, 2023 6:09 pm

CPX and datalogger extension and battery power

Post by bblakey »

I’ve been using my CPX devices to collect sensor data while they are connected to the computer. I found the MakeCode datalogger extension to easily collect and download data to a spreadsheet. Is there a way to use this extension, or another to collect data while the CPX is battery powered? I can’t seem to collect data without the computer providing power. Thanks!

https://learn.adafruit.com/data-logging ... -extension

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: CPX and datalogger extension and battery power

Post by mikeysklar »

This guide you linked to is based on a battery powered setup.

Are you pressing the 'A' button when on battery to initialize logging?

It would be a good idea to disable the logging console so the code does not hang trying to get access to the USB serial.

User avatar
bblakey
 
Posts: 8
Joined: Thu May 25, 2023 6:09 pm

Re: CPX and datalogger extension and battery power

Post by bblakey »

The tutorial I linked doesn't ever say to disconnect from the computer and plug into battery (or I've entirely missed that instruction). It also says "When your project is logging, a new flash drive should appear named MAKECODE" which suggests that the CPX is connected to the computer while the data is being logged. It also says " Pressing Reset or unplugging the CPX without pausing the data logging with the A button will corrupt the log.csv file!"

When I tested the code, I didn't get a log.csv file when it wasn't connected to the computer.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: CPX and datalogger extension and battery power

Post by mikeysklar »

This is why I say the guide is using a battery pack:
sensors_plant2.jpg
sensors_plant2.jpg (272.99 KiB) Viewed 128 times
After you have loaded the program code you can then unmount the drive, unplug the USB connection and run off another power source.

usage:
When you press the B button, the program logs the data to the flash memory (displaying green LEDs) until you press the A button, at which time the CPX displays yellow LEDs. This is your indication the data logging is stopped and you can copy the data to your computer as shown below.

The default time between logged data samples is 10 seconds as set in the last line of the forever loop. If you want a different time between samples, change this value noting the number is in milliseconds (thousandths of a second).

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”