|
@@ -0,0 +1,93 @@
|
|
1
|
+title: Pico BLE Vape Remote
|
|
2
|
+description: Replacement for S&B Vaporizer app
|
|
3
|
+parent: projects
|
|
4
|
+git: https://git.xythobuz.de/thomas/sb-py
|
|
5
|
+github: https://github.com/xythobuz/Volcano-Remote
|
|
6
|
+date: 2024-12-07
|
|
7
|
+comments: true
|
|
8
|
+---
|
|
9
|
+
|
|
10
|
+Like many modern devices, some of the medical vaporizer devices from S&B (the [Crafty](https://www.storz-bickel.com/de/crafty-plus-c), [Venty](https://www.storz-bickel.com/de/venty) and the [Volcano Hybrid](https://www.storz-bickel.com/de/volcanohybrid)) offer Bluetooth connectivity and [an app](https://app.storz-bickel.com/) to control them.
|
|
11
|
+
|
|
12
|
+Unfortunately the official mobile apps have / had some problems.
|
|
13
|
+The iOS version is no longer available after Apple decided to remove "drug related" Apps.
|
|
14
|
+So understandably the company no longer developed either their iOS or Android apps, instead releasing a web app that uses the Chrome Bluetooth APIs.
|
|
15
|
+
|
|
16
|
+Yet all of these variants are problematic in different ways.
|
|
17
|
+The Android app offers customizable workflows for the Volcano Hybrid.
|
|
18
|
+But the Bluetooth implementation is very wonky, sometimes simply missing steps in the workflow.
|
|
19
|
+And because there's no error checking, the workflow simply continues in a broken state.
|
|
20
|
+The webapp doesn't have this problem, but instead the workflows are no longer customizable, instead just offering a small number of hard-coded pre-defined workflows.
|
|
21
|
+
|
|
22
|
+This is not satisfying, of course, and also presented itself as a great opportunity to play around with BLE.
|
|
23
|
+
|
|
24
|
+Fortunately the official web app is made with non-minimized an unobfuscated JavaScript, so the BLE protocol for the different devices can easily be reverse engineered.
|
|
25
|
+I wrote a small [script](https://git.xythobuz.de/thomas/sb-py/src/branch/master/web-app/fetch.sh) that helps with downloading and beautifying the official sources.
|
|
26
|
+
|
|
27
|
+As a first attempt I implemented the Volcano workflow functionality in Python on the PC.
|
|
28
|
+I had some problems, so I made two implementations, with [bleak](https://bleak.readthedocs.io/en/latest/) and [SimplePyBLE](https://simpleble.readthedocs.io/en/latest/simplepyble/usage.html).
|
|
29
|
+Turns out my difficulties came from having multiple bluetooth adapters on my Linux machine.
|
|
30
|
+Now the scripts both work fine for me.
|
|
31
|
+
|
|
32
|
+<!--%
|
|
33
|
+lightgallery([
|
|
34
|
+ [ "img/volcano_remote_pc_2.jpg", "Volcano Remote script in action (old version)" ],
|
|
35
|
+ [ "img/volcano_remote_pc_1.png", "Volcano Remote script in action (current version)" ],
|
|
36
|
+])
|
|
37
|
+%-->
|
|
38
|
+
|
|
39
|
+Then I implemented the same thing on a [Raspberry Pi Pico W](https://www.raspberrypi.com/documentation/microcontrollers/pico-series.html#raspberry-pi-pico-w-and-pico-wh), with a [Waveshare Pico LCD 1.3](https://www.waveshare.com/wiki/Pico-LCD-1.3) display.
|
|
40
|
+I first did this in MicroPython but ran into issues as well.
|
|
41
|
+It works fine but I couldn't include all the functionality I wanted.
|
|
42
|
+
|
|
43
|
+<!--%
|
|
44
|
+lightgallery([
|
|
45
|
+ [ "img/volcano_remote_micropython.jpg", "Volcano Remote MicroPython prototype" ],
|
|
46
|
+])
|
|
47
|
+%-->
|
|
48
|
+
|
|
49
|
+So I made a fourth iteration, this time in C with the plain Pico SDK.
|
|
50
|
+It can interact with the Volcano Hybrid, the Crafty and the Venty.
|
|
51
|
+Everything can be controlled using on-screen menus on the device itself.
|
|
52
|
+It even has a WiFi capable OTA bootloader to support wireless firmware upgrades.
|
|
53
|
+
|
|
54
|
+<!--%
|
|
55
|
+lightgallery([
|
|
56
|
+ [ "img/volcano_remote_c_dev.jpg", "Volcano Remote C version in development" ],
|
|
57
|
+ [ "img/volcano_remote_bootloader.jpg", "Volcano Remote WiFi Bootloader" ],
|
|
58
|
+])
|
|
59
|
+%-->
|
|
60
|
+
|
|
61
|
+To contain everything I designed a snug little 3D-printed case in OpenSCAD.
|
|
62
|
+It contains the Pico W, a [Pico LiPo Shim](https://shop.pimoroni.com/products/pico-lipo-shim?variant=32369543086163) and a ["80mAh / 20 x 11 x 5mm / 501220" LiPo battery](https://www.ebay.de/itm/255510046348?var=555462939784).
|
|
63
|
+The Pi is mounted with four screws and the battery is held onto it with a drop of hot glue.
|
|
64
|
+Then the LCD board just plugs on top to close it.
|
|
65
|
+
|
|
66
|
+<!--%
|
|
67
|
+lightgallery([
|
|
68
|
+ [ "img/volcano_remote_case_1.jpg", "Volcano Remote case assembly" ],
|
|
69
|
+ [ "img/volcano_remote_case_2.jpg", "Volcano Remote case opened" ],
|
|
70
|
+ [ "img/volcano_remote_case_3.jpg", "Volcano Remote case power button" ],
|
|
71
|
+])
|
|
72
|
+%-->
|
|
73
|
+
|
|
74
|
+This is what the final result looks like.
|
|
75
|
+
|
|
76
|
+<!--%
|
|
77
|
+lightgallery([
|
|
78
|
+ [ "img/volcano_remote_case_4.jpg", "Volcano Remote (final)" ],
|
|
79
|
+])
|
|
80
|
+%-->
|
|
81
|
+
|
|
82
|
+I'm quite happy with it, especially the software part.
|
|
83
|
+It has many things I expect from nice modern embedded projects, and I've used a bunch of libraries to achieve these:
|
|
84
|
+
|
|
85
|
+ * [Pico SDK](https://github.com/raspberrypi/pico-sdk) for working with the Pico
|
|
86
|
+ * [TinyUSB](https://github.com/hathach/tinyusb) for the USB device implementation
|
|
87
|
+ * [BTstack](https://github.com/bluekitchen/btstack) for the Bluetooth connection
|
|
88
|
+ * [FatFS](https://github.com/abbrev/fatfs) for the USB filesystem
|
|
89
|
+ * [MCUFont](https://github.com/mcufont/mcufont) for rendering text
|
|
90
|
+ * [st7789](https://github.com/hepingood/st7789) for interacting with the LCD
|
|
91
|
+ * [picowota](https://github.com/usedbytes/picowota) bootloader ([modified](https://github.com/xythobuz/picowota) to work with the Flash config storage and LCD)
|
|
92
|
+
|
|
93
|
+As usual you can find everything on my [Gitea](https://git.xythobuz.de/thomas/sb-py) and on [GitHub](https://github.com/xythobuz/Volcano-Remote).
|