Most active commenters
  • mtlynch(6)

←back to thread

756 points mtlynch | 17 comments | | HN request time: 0.693s | source | bottom
Show context
mtlynch ◴[] No.23927535[source]
Author here. Happy to answer any questions or take any feedback about this post.
replies(13): >>23928048 #>>23928079 #>>23928102 #>>23928108 #>>23928824 #>>23929025 #>>23929273 #>>23931092 #>>23931871 #>>23931962 #>>23932019 #>>23932032 #>>23935887 #
1. ghaberek ◴[] No.23928102[source]
Would a Pi Zero W work for this, or do you need a full-size Pi 4? I would think that with the HDMI dongle doing the hardware MJPEG encoding, a Pi Zero might suffice. It'd be really neat to A) bring the cost down another $30 and B) be able to package everything into a tiny 3D printed case.
replies(3): >>23928203 #>>23929540 #>>23932694 #
2. mtlynch ◴[] No.23928203[source]
Thanks for reading!

>Would a Pi Zero W work for this, or do you need a full-size Pi 4?

I tested Key Mime Pi (the keyboard-only version) on the Pi Zero W and it worked great. I haven't tested TinyPilot on the Pi Zero W, but I think it will work. The video encoding is happening in the HDMI dongle, so it doesn't hammer resources much. I don't have a USB to microUSB adaptor on hand, but I'll order one now and see if it works.

>be able to package everything into a tiny 3D printed case.

Yeah, that would be neat! One of the biggest issues I have with TinyPilot's setup right now is that it looks kind of like a bunch of random hobbyist parts stuck together. A 3D printed case would be good and wouldn't have the heat issues that Pi 4 has.[0]

[0] https://www.jeffgeerling.com/blog/2019/best-way-keep-your-co...

replies(2): >>23929197 #>>23930046 #
3. cricalix ◴[] No.23929197[source]
You might also be able to use the "standard" radio kit metal boxes - tap some standoffs, carefully drill some holes for wires etc. Dunno which works out better for the world - ordering a pre-fab metal box that you have to do some work on (or perhaps use https://www.frontpanelexpress.com/ to get a customised enclosure), or printing something from plastic. Might depend on production volume, metal used etc.
4. Deathmax ◴[] No.23929540[source]
I think you might run into a lack of connectivity on the Pi Zero W. Since the only data USB port has to run in device mode, I would assume you can't connect the HDMI capture device.
5. trm42 ◴[] No.23930046[source]
Do you happen to have any idea, whether older RPIs like 1 or 2 could work for this fast enough? Have some of those laying around.
replies(1): >>23931027 #
6. mtlynch ◴[] No.23931027{3}[source]
The video capture part should work, but I don't believe they support USB OTG, so they wouldn't be able to impersonate the keyboard.

The official documentation[0] says all Pi devices have USB OTG, but I'm not sure if there's something else about the Pi 4 and Pi Zero W that allows USB gadget mode because I've never found anyone talking about using it before recent generations of Pi. This StackExchange answer says the A and the A+ had it, but that the 2 doesn't.[1]

[0] https://www.raspberrypi.org/documentation/hardware/raspberry... [1] https://raspberrypi.stackexchange.com/questions/71613/how-to...

replies(2): >>23931264 #>>23934089 #
7. Scaevolus ◴[] No.23931264{4}[source]
I'd expect the Pi Zero W to be fast enough to pass through the MJPEG stream and impersonate the keyboard, which should cut the cost by $20+ plus however much you save on not needing a fancy case.
replies(2): >>23931891 #>>23932517 #
8. mtlynch ◴[] No.23931891{5}[source]
Yeah that's true. I stopped thinking about the Pi Zero W early in the project because I assumed it would choke on video encoding. When I discovered that the HDMI dongle was doing the heavy lifting, I forgot to revisit that assumption. I'm going to order an USB to micro-USB adaptor to test it out because it would slim things down significantly.
replies(1): >>23934283 #
9. ◴[] No.23932517{5}[source]
10. Nexxxeh ◴[] No.23932694[source]
The immediate issue would be the Pi Zero W only has one usable (micro)USB port, the other port is Power In only. If you run it for OTG, you can't use it for the dongle.

There would be ways around this though, perhaps using a cheap microcontroller for the USB HID stuff.

replies(1): >>23932779 #
11. ghaberek ◴[] No.23932779[source]
Yeah I forgot that only one of the USB ports actually does data. I guess you could use a Teensy that interfaces through the GPIO pins and pretends to be the keyboard and mouse.
replies(1): >>23933032 #
12. Nexxxeh ◴[] No.23933032{3}[source]
That's what I'm thinking, or worst case, one that communicated via USB to TTL adaptors. Or an ESP-based board that connects over WiFi. Or BT-enabled board.

Combined with a HDMI switch, you could then control multiple devices with just one Pi+Cap device.

I've been looking to do something similar for a while, albeit possibly with Windows as that's where I've (very rusty Delphi) programming experience.

13. gruturo ◴[] No.23934089{4}[source]
Any Pi with just one USB port (zero, A, A+, 3A) is capable of USB gadget mode because there is no hub between the SOC and the port.

Those with multiple ports have a hub in between and are not capable of gadget mode.

The pi 4 is an exception, it is capable of gadget mode on its USB-C power input, not via the normal ports as there is a hub in between there too.

14. Scaevolus ◴[] No.23934283{6}[source]
Woops, forgot the major issue-- the Pi Zero only has one USB port (the other is just for power), so you couldn't get video frames in at the same time as you pretended to be a keyboard.
replies(1): >>23935035 #
15. mtlynch ◴[] No.23935035{7}[source]
The Pi Zero's power port is actually a USB OTG port. I used it in my precursor project to forward keystrokes:

https://mtlynch.io/key-mime-pi/

replies(1): >>23945450 #
16. magicalhippo ◴[] No.23945450{8}[source]
On the web page you explicitly say to connect it to the port labelled "USB", which is not the power port.
replies(1): >>23946167 #
17. mtlynch ◴[] No.23946167{9}[source]
Whoops, you're right. I misremembered. It's power on the Pi 4 and data on the Pi Zero.

Thanks for the correction!