I Hacked My Standing Desk with a Raspberry Pi
medium.com
medium.com
I'm with the group that thinks a Wemos D1 or other ESP8266 micro is probably a better match for the application (if you want to keep open a Wifi control option; if not, literally any microcontroller board would be fine), but if you know Linux and python and not C or have never touched a microcontroller before, not a lot of harm in going for the PiZero.
What I like about microcontrollers is that they just work for years on end. I've got one at home that's been running for about 10 years now, untouched (which makes sense, since most of our gadgets work that way as well).
My criteria were: 1. What's easy? 2. What's cheap? 3. Raspberry Pis are cool. I wouldn't mind playing with one.
I actually have programmed a microcontroller in C before (an Atmel Butterfly) but that was... 15 years ago? I haven't written C in at least 5 years.
I'm fairly optimistic that the Pi would have continued for years. It has no connection to the internet, and the code is extremely simple. If I were designing a device that somehow needed to run without being touched for 10 years, then definitely a microcontroller would have been the way to go. Or maybe even just a timing circuit, no processor involved.
But since you've got the Pi, the next logical step is to get an rtc upgrade and run chrony/openntpd and a backup dns cache. Why not? I mean its right there on the desk. Could add a quick binary clock for practicality.
Since you might now be dependent on the thing, its easy to add snmp for monitoring, hack in some rrdtool or whatever to graph your sit/stand time, maybe a serial connection to monitor your UPS power situation, and you get a free Pi-hole by now! Probably a little overkill to run wireguard on the thing, though.
But honestly, why stop there? Have it control some functional LED lighting[0] (Zack uses an ESP32 instead of the pi--must not care about clock drift. The biometric sensor is also a little expensive and uncomfortable looking.) with suntime[1] for a perfectly and coherently illuminated environment.
For the extremely paranoid, yet lazy and obsessive (who does that not describe?) you can grab an extra wifi dongle with raw monitoring mode to have some fun with trackerjacker[2]. Use an innovative static base station running map mode, so when an influx of unknown devices with increasing strength and/or known vehicle SSIDs or PAN beacons are detected, just go full Red Alert (using those very practical leds) and score a quick win by raising the desk and commanding your IoT lighting for a deft escape.
Maybe you can use this for the girlfriend too, since by now you've already got rrdtool or cacti or whatever graphing the desk height and trackerjacker output from her iPhone and Jeep Latitude hotspot, you could also use that capability to gain insight as to when it should reach out and trigger your coffee maker's ESP32, certainly while raising the desk.
[0] - https://www.youtube.com/watch?v=g6n8XLmZ__I
[1] - https://github.com/SatAgro/suntime
[2] - https://github.com/calebmadrigal/trackerjacker https://reconshell.com/trackerjacker-maps-and-tracks-wifi-ne...
My desk was made by LINAK, who also provides some IKEA standing desks too. Here’s the adaptor if anyone is interested: https://www.linak.com/products/accessories/bluetooth-adapter...
I use a script that’s triggered with a keyboard shortcut which I find super cool.
I got it by reaching out to a local distributor of Linak products in my country as I couldn't find any online website selling it at the time. You might try that, they might even know if it's compatible (or at least would know how to check).
Oh, I would suggest getting the new controller instead of the dongle since that one supports both BLE and it has physical buttons which is always great.
I wonder if the pi would have beaten me?
*Desks with the same number of monitors (weight) would raise with the same speed.
The solution i am working on is that i am repurposing a PC power supply and then bought several high amp buck converters. I am wiring the 12v and 5v rails to the different buck converters to get the required 19v for my monitors, 24v for speakers, etc. All of this is a single unit much smaller and I can cut the wires to length to reach each device exactly.
They work really well for a small(?) constant load. I use mine for a Chromecast because my TV doesn't have always on USB ports.
My only complaint is that it's a little large, so if you have a tight configuration on a powerstrip, it might not fit with other bulky adapters in the adjacent slots.
0: https://www.walmart.com/ip/Twist-Charge-USB-Charger/33490454 (Walmart link because I'm sure it will stay around after they're sold out).
1: The meh.com listing with more information: https://meh.com/forum/topics/2-for-tuesday-bracketron-twist-...
Doesn't anyone know how to program an MCU timer anymore? I mean, prescalers and clock trees really aren't that scary...
I'm not sure NTP over wifi is a big deal either. The problem space here isn't millisecond accuracy, it's regaining time after a power-off, as the pi lacks an RTC.
It didn't go well. Now I am learning KiCAD...
BTW, this is often totally undocumented (often blatantly on purpose) and you basically need to find a video review of the desk in question where you can see the desk move on its own or else it's not guaranteed it will do that & you will spend a ~minute every time you want to rise or lower the desk to the standing/sitting position.
Another thing I'd also look at, for a particular model, was how faithful the electrical/mechanical interfacing of the hack, and whether that had implications for system operation safety.
My thought was "Save yourself some time/effort and do what I do: set a timer to remind you to stand."
https://www.zenspacedesks.com.au/product/professional-series...
It would be hard to detect a problem going down since the leg could just lift off the ground.
Edit: removed my stupid comment about leaving stuff exposed to the internet - that was a DIFFERENT article I read about a similar project after this one! [0] My bad… it’s late here…
TLDR; this article inspired me to go down a rabbit hole…
[O] https://medium.com/google-developer-experts/hey-google-set-m...
Which is ten bucks. A Raspi Zero is five bucks. Sure, there's... something elegant about using less computer for more money but... what?
I'm sure someone has a link to an Alibaba ripoff for like fifteen cents (might even be why I'm saying this) but like: five bucks and you already know Linux?
Really, why not?
* Patching/attack surface. I don't want to maintain a full Linux OS, and I expect (hope) that the network stack on something like an Arduino or ESP is both secure by obscurity (I know...) and by lack of functionality.
* Some things are much easier on a simpler chip as well, like bit-banging access to a NeoPixel, due to the lack of a multitasking OS.
* Bootup times on simpler chips are mostly imperceptible. They power up and begin running your code. (Arduino includes a short pause you can remove, or you can bypass the Arduino boot loader entirely and program the AVR directly.) Even the slimmest of Linux distros can't beat it.
I would also just use an Arduino here, I've got a box of tiny ones (Adafruit feather) which would be plenty for this application, and I'm already familiar with the platform. From bit-banging Neopixels, as it happens.
But for running an incredibly simple cron job on a standing desk, none of these are compelling. It makes perfect sense for someone who knows Linux, and doesn't want to learn Arduino, to just break out a Raspi Zero and do what he did here.
It's air-gapped, so the risk of it getting pwned to mine Monero or whatever is pretty minimal. There are no real-time considerations for an action which happens once an hour +/- a few minutes, and boot-time for an application where the first action is around an hour from power-on is also not decisive.
The best deal I have found is ordering from adafruit where you can get 1x with headers and 1x without headers. Then you end up paying only $8-9 each. And that's for the zero. The zero W (wifi) is $10.
My parents live near one of the stores, and I will always stop in to grab one.
Also, as far as I know there aren't a ton of Pi clones, since it's not fully open hardware. I believe the Broadcom chips in there are pretty closed.
My plan was to slowly move the desk up while keeping the display the same, or something else nefarious like that.
I was hoping to find something about how he was reading the stored height information from the desk so that he could either automatically or over SSH set the desk to specific heights though.
His hack just moves the desk up for a second approximately every 50 minutes. So I guess he just lets it go to max height when he's away, manually sets the height to where he needs it to stand, and just goes back to sitting whenever he feels like it.
Anyway, I'm the guy in the article. AMA.
>Then I just plugged the Pi into a USB power brick, and… it worked!
Might as well attach a diesel-fueled generator and a pentium 4 to the back of the desk.
The project seems like a perfect opportunity to play around with some arduino-like board. It could probably be embedded inside the control panel and powered from the desk itself.
I agree but still think there's value in having this kind of content abound on the internet as it gives beginners with zero experiance a good starting point.
> Might as well attach a diesel-fueled generator and a pentium 4 to the back of the desk.
Maybe but it's 5 bucks so who really cares.