Measures power consumption of P7/P8 attached to Windows laptop
Runs as a "Github app" alongside the CircleCI Github App
Only triggers on repositories named "dialog_14683_scratch"
Secrets (i.e. API keys) must be added in ".env" file. Example provided in ".env-example"
Needs to run on Windows because the script to flash the P7 is "initial_flash.bat". Path to dialog_14683_scratch repository must be specified in reprogram_p7.sh
High level overview of program flow:
Created from Github App Template: You can use this GitHub App template code as a foundation to create any GitHub App you'd like. You can learn how to configure a template GitHub App by following the "Setting up your development environment" quickstart guide on developer.github.com.
- Segger J-Link that's not an EDU (the EDU has an annoying daily EULA prompt)
- (P7 or P8) with tail
- DC power supply set to 3.7V
- Joulescope
- Ring breakout for its low power consumption:

Power overhead:
- The Segger JLink consumes 25μA
- The SN74LVC1G14 consumes 10μA
- Install the Github App to
dialog_14683_scratchhttps://github.com/settings/apps/in-office-power-consumption-tester/installations - Install Ruby on Windows: https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-devkit-2.7.4-1-x64.exe
- In the MINGW32 shell:
gem install bundler
Successfully installed bundler-2.2.23
Parsing documentation for bundler-2.2.23
Installing ri documentation for bundler-2.2.23
Done installing documentation for bundler after 7 seconds
1 gem installed
- To run the code, make sure you have Bundler installed; then enter
bundle installon the command line. - Download the dialog_14683_scrach repository: https://github.com/happy-health/dialog_14683_scratch/commit/3783e54852da80221fcf7106535b101574277d2e
- Install JLink DLL V670d (v6.12i does not work)
- Ensure JLink is running firmware v6.70d (2020-04-16)
SEGGER J-Link Commander V6.70d (Compiled Apr 16 2020 17:57:43) DLL version V6.70d, compiled Apr 16 2020 17:56:51 Connecting to J-Link via USB...O.K. Firmware: J-Link V11 compiled Apr 16 2020 17:17:32 Hardware version: V11.00 S/N: 821005715 License(s): GDB VTref=3.349V
- Install Node
npm install --global smee-clientcd pyjoulescopepython -m ensurepippip3 install -U -r requirements.txt- Put a shortcut to Joulescope in Startup folder (or else
cannot open gdb interfaceon reboot) - Edit template_server.rb to have to correct paths for
DIALOG_WORKSPACEandDIALOG_WORKSPACE_WITH_ALT_DRIVE_LETTER - Manually create these folders. Or else the script will error
"${DIALOG_WORKSPACE}/projects/dk_apps/templates/freertos_retarget/Happy_P7_QSPI_Release/"
"${DIALOG_WORKSPACE}/sdk/bsp/system/loaders/ble_suota_loader/DA14683-00-Release_QSPI/"
- Edit the permissions in those folders to include write for all users
- Create a copy of the
.env-examplefile called.env. - Change the "Dialog workspace" directory in
reprogram_p7.sh - Add your GitHub App's private key, app ID, and webhook secret and the CircleCI API key and the key of an AWS IAM user that has access to S3 to the
.envfile.
- Click "start-smee-and-server.bat". Two windows should appear. One for the smee-client and one for the Sinatra Ruby Server. This file can be used to restart the server too.
- View the default Sinatra app at
localhost:3000. It should saySinatra doesn’t know this ditty.
The command-line windows should look like this:

- Ctrl-C both command-line windows,
- Kill all Ruby instances and node by running
kill-smee-and-server.bat - Check the smee server is running on AWS
- restart both commands
- All the calls to and from the Github API from this application are logged here and can be re-sent: https://github.com/settings/apps/in-office-power-consumption-tester/advanced
- Is the server running? To make the server start in boot, I added the batch file to "Startup Apps"
5. ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x64-mingw32]
