Loading files…
Because the Internet of Things needed a smart soda maker.
There is (or was) a soda maker called "SodaStream Power". It has some buttons and LEDs and uses a servo to do the usual pushing motion that soda makers require. Mine was broken probably due to an unfortunate design decision (and me). So I thought: If I have to fix it by replacing the MCU either way, why not use a WIFI-enabled one? So I build a replacement PCB with an ESP8266. It even runs python! 😲
Disclaimer: It doesn't access the internet. But it could! -- But what for? Maybe I should blink the current time in morse code for each new soda, or add a cloud backend so I can better scale my soda making. 🤔😉
So what does it use WIFI for? Well, I can debug it remotely while it's standing in the kitchen. 😅
Otherwise it just does, well, make soda. Though I improved (imo) the user interface a little.
ℹ️ I did this project in 2019, but I rewrote the software and documentation in 2023, so some details might be lost to time.
The PCB was designed in KiCad and fabricated by JLCPCB in 2019.
Main components:
ESP8266-12FPCF8574AN
A implies a different I2C base address than the version without the A. The non-A chip works as well (but needs a minor change in code). (Took me a few hours debugging before I realized I stared at the wrong data sheet.)SI7205-B-00-IVTPS22810DBVR⚠️ Warning: The KiCad project was converted from an older KiCad version. I'm not sure if that worked ok.
For ease of use I made some screenshots of the schematics.
I measured the holes and cutouts on the original PCB and used identical ones on my PCB so it fits in the PCB holder. The pink areas are markings for special locations in the PCB housing: Left and right areas are keep out zones for the housing's snap fit hooks. The area in the center marks where the cabling leaves the water-proof housing.
This project uses micropython version 1.20.0 installed as per the documentation for ESP8266. Here's the command I used:
esptool.py --port "${DEV}" --baud 460800 write_flash --erase-all --flash_size=detect 0 ESP8266_GENERIC-20230426-v1.20.0.bin
After that we can upload the code with micropython's pyboard.py tool. The configs ./src/webrepl_cfg.py and ./src/wifi_cfg.py require some adjustments.
After that, you can access the board via WiFi in the browser at http://192.168.0.123:8266/ (or which ever IP your board got, mDNS would be an improvement here, see Future Work).
Iirc the vendor UI was very basic: We have 3 buttons and 3 LEDs, when you insert a bottle all LEDs light up. Then you press one of the buttons, you get a low, medium, or high dose of CO2 into the bottle. The different doses are solely achieved by opening the CO2 valve for different, fixed durations.
Of course, that is reasonable, but it's actually a not much of an improvement compared to the manual soda makers. The main drawbacks are:
Drawback 1. is easily mitigated by beginning to open the CO2 valve as soon as a bottle is inserted. This means I cannot select the dose beforehand. This can be remedied by allowing a change of the dose during the operation. (This change is only in effect for the current soda making.)
I solved drawback 2. by tracking the cylinder state. I redefined the buttons to mean left = "less CO2", right = "more CO2" (center = "abort/restart"). If a selection is made after the soda making is done, it is saved for next time. So when the CO2 cylinder empties, I can adjust the valve opening duration step by step whenever a bottle is not pressured to the degree I want. I also added some more subtle functions, and a debug mode:
| Button | Held Down Before* | Pressed While | Pressed After |
|---|---|---|---|
| left | (+right) reset cylinder state | less CO2 (temp) | less CO2 (saved) |
| right | (+left) reset cylinder state | more CO2 (temp) | more CO2 (saved) |
| middle | debug mode (WiFi) | abort | start again |
Table: Effect of buttons (1) held down while inserting a bottle, (2) pressed while the soda making happens, and (3) pressed after the soda making is completed. (* If any button is held down while a bottle is inserted, the CO2 valve stays closed. So resetting the cylinder state and entering debug mode can be done without wasting CO2.)
I ran into some issues:
WebREPL:
ctrl+c to end the running program.Boot Time:
import uos
from flashbdev import bdev
uos.VfsLfs2.mkfs(bdev)
vfs = uos.VfsLfs2(bdev)
uos.mount(vfs, "/")
boot.py -...-> main.py -> sprudler.mpy. That is mainly because boot.py and main.py cannot be compiled .mpy files. In boot.py I only put everything that I want done ASAP and main.py only imports the compiled .mpy file. I experimented a lot while trying to bring down boot time. I did not save the experiment results, but this solution got the best results for my use-case.boot.py I move the servo to the second (2) position. While the servo is moving to that position, we load the rest of the software and regular operation begins. This reduces the effective delay until operation begins..mpy file, I experimented with regular global constants, constants marked with const(), and plain inserted constants. I'm not entirely sure what worked best, because while experimenting I also stumbled upon the issue above. Iirc boot time was best with inserted constants. So I stuck with that and added a preprocessor step using regular C preprocessor defines like #define MY_CONST 123 in sprudler.py. (They get slightly garbled by the black formatter, but meh, I just undo this in the Makefile. Not elegant but works ok.)WiFi AP:
1.20.0, so I disabled it (see issue).
import network; network.WLAN(network.AP_IF).active(False)
After some tries it will hit after the REPL becomes ready but before the AP is set up and the boot loop stops.PWM:
Why am I doing this? Well, the electronics of my soda maker "broke", here's what happened:
The original circuitry has a tilt switch. It is just a conductive ball resting on two parallel wires, thus shorting the connection. The whole thing is in a black rectangular plastic housing with enough head room so the ball can slightly move upwards. If the PCB is flipped upside down the ball will fall away from the wires (now an open circuit) and the MCU will register that.
It turns out, if the device is on, you flip it upside down, and press any button, the MCU will go into an error state and blink the LEDs. Okay fine, maybe we just don't want our precious soda on the floor. But there is no way to get out of this error state! Not power cycling, no combination of button presses, short and long presses, with or without a bottle inserted, I tried everything I could think of. So ... this device just bricks itself? 🙃
Side note: If you are that kind of person (like me) who wants to know how devices work, and like to open them up to find out, you sometimes move parts aside, like for example the PCB, and maybe even let it dangle upside down on the side since the cables are so short...
However, I cannot be 100% certain that this is what bricked it. But there is a tilt switch on the PCB, it's connected to the controller, and the device went into the error state once I operated it with the PCB hanging upside down. But it could have been something else I did, who knows.
Why would the manufacturer do that? Not sure, maybe it is due to a regulation? CO2 in compressed gas cylinders is actually liquid. So from what I read, if you operate the valve while the CO2 cylinder is upside down it will spill the liquid CO2 which is very cold due to the drop in pressure. Maybe they wanted (or had) to prevent this hazard. (But why permanently!?)
No comments yet. Be the first to ask about this board.