desk icon indicating copy to clipboard operation
desk copied to clipboard

Simplify this project using a Raspberry Pi Zero

Open davidknezic opened this issue 6 years ago • 15 comments

Currently, this project is quite complex to implement due to the Hub/desk module combo and the ZigBee communication.

I think it might be time to simplify this project using a simple Raspberry Pi Zero. There, WiFi and GPIO handling can all happen on one device.

davidknezic avatar Jan 24 '19 12:01 davidknezic

I am definitely going to control by desk from a RPI itself... I will eventually let you know when I progress further. I am still waiting for the table.

MartinNuc avatar May 25 '19 20:05 MartinNuc

Awesome! Let me know how it goes šŸ™‚

davidknezic avatar May 26 '19 20:05 davidknezic

Finally had time for this during the quarantine 😷

It turns out that Raspberry GPIO pins are only 3.3V while Arduino is 5V. I am afraid that LogicDesk sends 5V which would destroy my RPI and I don't have currently a multimeter to measure it šŸ™

MartinNuc avatar Mar 29 '20 19:03 MartinNuc

Hi @MartinNuc, good to hear from you!

The Raspberry Pi has two 5V pins (2 + 4) that come directly from the 5V power supply.

With a step-down or step-up level shifter circuit you can interface with the LogicDesk circuit. They consist of simple components and I've used them on several occasions.

Maybe this will work for you too?

davidknezic avatar Mar 30 '20 11:03 davidknezic

@davidknezic ordered step down/up yesterday. Should arrive in following days šŸ¤ž

MartinNuc avatar Mar 30 '20 12:03 MartinNuc

FYI I am almost done with the driver for raspberry. Its my first project in Rust therefore the code is šŸ’©

https://github.com/MartinNuc/logic-data-controller

It exposes REST API for controlling the table. Honestly to avoid step-up/down shifter I would prefer Arduino šŸ˜€

MartinNuc avatar Apr 06 '20 22:04 MartinNuc

Thank you very much for sharing! Rust seems to be very cool.

The only reason I though migrating to Rpi Zero W was because it's cheap, has Wifi and runs Linux (for HomeKit). But I guess the same things can be achieved with an Arduino. If you find a model, I'd love to know which one you went with. I totally agree with you that it makes sense to use the board that makes things easiest.

davidknezic avatar Apr 07 '20 08:04 davidknezic

Unfortunately you cannot run linux on Arduino. So using raspberry is really "one-package" solution but the setup of wires is rather complicated 😱 ... see the photo šŸ™ˆ

IMG_4240

MartinNuc avatar Apr 07 '20 13:04 MartinNuc

There is an issue with raspberry that it doesn't manage to keep the loop under 1ms. Especially when there is something else going on on the device. Therefore it reads the signal wrong.

At first I wrote the driver in Typescript and I thought the reason it run fast enough is Javascript - maybe garbage collector. But even with Rust I see lagspikes which causes to skip reading bit or even more from the signal channel time to time. Which results in delays when reading the table height.

Really looks to me that using Arduino for this is much better solution :-)

MartinNuc avatar Apr 12 '20 22:04 MartinNuc

After using it for some time it mostly works ... I am pretty much sure there is still the problem with delayed reading of the signal channel.

I am wondering - using Arduino - does it happen that the table controller display stops showing height values? And sometimes that it resets memory positions?

MartinNuc avatar Apr 20 '20 18:04 MartinNuc

Glad to hear that it's been working so far.

Yes, at some point the controller stops sending the height. I noticed that I just have to give a very short impulse (up or down) to make it send the height again. If the impulse is short enough, the desk won't really move.

About the memory positions, I'm not sure. Do you mean the programmable heights you can set on the hand switch? Unfortunately, I don't have those.

davidknezic avatar Apr 21 '20 00:04 davidknezic

Just stopping by to say this project is amazing and I’d love to try it. How is the setup working out?

ryanschmidt avatar Oct 17 '20 12:10 ryanschmidt

I'm currently waiting for parts, but will give this a try (using RPI only). Many thanks @MartinNuc and @davidknezic for the amazing work on their respective projects. Looking forward to get this going!

visini avatar Oct 22 '20 15:10 visini

Hi @ryanschmidt @visini thank you for the kind words!

How is the setup working out?

@ryanschmidt I myself still run the original setup described in this repository and it is very reliable.

Still have the plan to migrate to a Raspberry Pi Zero W only setup, but the lack of real-time processing that @MartinNuc has mentioned earlier will be a challenge. I wonder if running the kernel in real-time mode would help there.

@visini just saw your issue over at MartinNuc/logic-data-controller#1. Will compare it to my wiring an let you know what I find out.

davidknezic avatar Oct 26 '20 14:10 davidknezic

@davidknezic I was thinking to simplify this by separating the device into two. An ESP32 or ESP8266 running the arduino code and connected directly to the wifi. The rpi (or anything really) acting as a server that connects to the ESP and exposes it to homebridge. I have a similar setup for an IR emitter that acts as an AC remote so it shouldn't be too hard -- (last famous words).

dpinna13 avatar Dec 02 '21 17:12 dpinna13