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
CPX and datalogger extension and battery power
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- bblakey
- Posts: 2
- Joined: Thu May 25, 2023 6:09 pm
- mikeysklar
- Posts: 10674
- Joined: Mon Aug 01, 2016 8:10 pm
Re: CPX and datalogger extension and battery power
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.
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.
- bblakey
- Posts: 2
- Joined: Thu May 25, 2023 6:09 pm
Re: CPX and datalogger extension and battery power
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.
When I tested the code, I didn't get a log.csv file when it wasn't connected to the computer.
- mikeysklar
- Posts: 10674
- Joined: Mon Aug 01, 2016 8:10 pm
Re: CPX and datalogger extension and battery power
This is why I say the guide is using a battery pack:
After you have loaded the program code you can then unmount the drive, unplug the USB connection and run off another power source.
usage:
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).
Please be positive and constructive with your questions and comments.