Programming
Connecting
Connecting is super simple. You can connect wirelessly via Web Bluetooth using a supported browser and OS.
Checking the firmware
The NRF52832 module located on the pulse core mainboard should already be flashed with Espruino firmware (if it isn’t, see advanced instructions for flashing firmware via the SWD pins).
If you aren’t already familliar with Espruino firmware, it is a lightweight JavaScript interpreter designed to run on microcontrollers like (in this case) NRF52-series chips. It is well known for being easy to hack on and debug, thanks to the ability to have a completely wireless serial connection. With this, you can manipulate variables, control GPIO, and test functions without any interruptions. Cool!
Updating the firmware
Every now and then, an update to the Espruino firmware will become available. Because this uses a fork, there is not currently a great way to update this, however work is being done to change this. Eventually this will be possible via DFU.
Uploading software
Firmware alone won’t give you much to do, however. For that, we need to load a main program (referred to as an app). The OpenInhaler App Loader (a fork of the Espruino App Loader) provides apps specificly meant to run on the pulse core.
There are a few apps available, depending on how you are using the Pulse Core.
- For simple testing of all available hardware and electrical components, see Self Test.
- For use as a projectile launcher, see Projectile Launcher.
- For use as a button presser, see Button Presser. Note that for faster pressing, you may want to replace the N20 motors with higher RPM ones.
- For use inside the Pulse inhaler, see Pulse Inhaler. Note that this is community firmware, not intended for actual medical use. This is provided for testing and educational purposes only!
The first step in programming is connecting to the pulse over BLE via the Espruino Web IDE OpenInhaler App Loader. Simply choose the Pulse device, click connect
icon and select the device from the list.
Once connected, you may try out the code snippets below to interact with some of the sensors on board.
Reading the air velocity sensor
The Pulse core contains the FS3000-1015, a small digital air-velocity sensor from Renesas Electronics Corporation. This sensor lets us detect when a person is breathing in, and the force they are using to do so.
Since the FS3000 consumes a decent amount of power, a transistor has been placed in line to switch it off when not needed. You must first switch it on using the proper GPIO pin before you can connect to it.
// Enable FS3000
Then, you’ll need to initialize it as an I2C device
// Connect over I2C
Finally, you can take readings
// Take readings
See Espruino’s documentation on the FS3000 for more information.
Triggering a dose
You can trigger the dispensing of a single dose with this simple function call
pulse();
The pulse will retract and recharge the tension springs automatically as part of this function.
Developing
If you’re interested in developing software for the Pulse Core, this section is for you!