Closed hannemann closed 2 years ago
Interesting idea but ATM i don't own such a device and its a little bit pricey at least on Amazon. I ordered one anyway and give it a try ;)
Nice! Also ordered one to be able to test/provide support
May i ask you how you use the Device? It's supposed to be used with a TSOP to be able to replace the remote of an android TV with an arbitrary IR one. The latency when using IR is next to nothing for a button press and about 150ms for a button release to debounce the signal. Did you consider to use it that way or is your use case different?
I use it to be able to control my Shield TV which has no USB with my Harmony One which does not support Bluetooth. This works really well and there is no noticeable downside compared to the original remote apart from the microphone which i don't use anyway. It's even better IMO since i can start apps of my choice with Keymapper and use apps that are not designed to be used with a remote when switching the mouse mode on.
My use case is a little bit different. I'm using a Neeo remote (https://www.kickstarter.com/projects/1227115988/neeo-the-thinking-remote). It was kickstarter project that has been sold by the founders to Control4. The design of the remote is perfect and there is a SDK to create and control your own devices. Because Neeo is sold to Control4 the servers are going down in a few months. To get around this future problem a Neeo owner created a driver (https://github.com/jac459/meta) to control your own hardware en simple create your own drivers.
I created a little driver for my remote to control your BLE-Remote-Companion tru websocket (and control my shield). The BLE-Remote-Companion is very fast en I really like the keymappings to start programs like Netflix/Disney/Kodi/Youtube directly. But for example when I push the arrow button very fast it misses sometimes a keypress.
In the past I used a raspberry pi Zero w (https://github.com/gvdhoven/websocket-to-ble-hid-bridge) but I needed raspberry+bluetooth device+usb to ethernet. And I like the only esp32 design.
Thanks for the info.
Great that you have the opportunity to build your own driver. I wait for the day my harmonies can't be programmed anymore. Hopefully Logitech opens the software like they did with LMS.
Did you try to implement keydown and keyup in your driver? As long as no keyup is sent the keydown is repeated by the Shield itself and there is no need to fire several rounds on your arrow buttons ;)
Did you add the keymappings via the Keymapper app or do you have another approach?
I really liked the harmony remotes in the past, they where the best universal remotes for tech savvy users.
If my Neeo remote dies I switch over to YIO 2 (https://www.yio-remote.com/). It is still in development.
I dont use keydown/keyup but keypress..
In Android I'm using a keymapper app (payed), in kodi Keymap Editor.
Harmony Remotes are great but the software.... The only reason why i have a windows instance btw. If my dies I'll use a cheapo universal remote with the Companion. That's why i did it :)
Can you measure the latency of the signal? I used a simple Node Red flow to test and its somewhere between 30 and 80ms so should not be too much of a problem.
I've found a Websockets Library for the WT32 that could fit but a change to that should be not that easy so it'll take some time.
In the meantime I suggest implementing keydown and keyup in your driver if possible and look how it behaves if you keep the button pressed instead of fast repeated keypresses.
Was way easier than i thought :) No need to swap out any libraries... Just works
Checkout feature/wt32-eth01 and compile the newly added env. Latency was 20ms with 17ms of bluetooth. So no network related latency at all anymore.
Thats fast! Both the (almost none) latency and adding the support to this board.
I'm getting a error when I try to build the firmware in platformIO:
src/WebService.cpp: In static member function 'static void WebService::WiFiEvent(system_event_id_t)': src/WebService.cpp:172:38: error: 'ETH' was not declared in this scope String hostname = "blerc-eth-" + ETH.macAddress();
I'm going to change my driver to keydown/keyup. Do you have a example node red flow to check the latency?
I get this error when i try to compile the default env.
In vscode next to the PlatformIO Buttons you should see env:default (BLE-Remote-Companion)
Klick on that an than choose env:WT32_ETH01
in the command dropdown on top.
Example:
[{"id":"38bb52a74adab1df","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"7ac7acab0bd35a4d","type":"websocket out","z":"38bb52a74adab1df","name":"BLE-RC out","server":"","client":"8294c7d8a6eda105","x":490,"y":100,"wires":[]},{"id":"42ec8194abf3f0ed","type":"function","z":"38bb52a74adab1df","name":"","func":"flow.set(\"start\", Date.now());\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":100,"wires":[["7ac7acab0bd35a4d","e7f1716f6037163f"]]},{"id":"fb0bf6a3dbbd4808","type":"inject","z":"38bb52a74adab1df","name":"ESCAPE","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"method\":\"keypress\",\"params\":{\"type\":\"KEYBOARD\",\"code\":\"KEYCODE_ESCAPE\",\"longpress\":false}}","payloadType":"json","x":140,"y":100,"wires":[["42ec8194abf3f0ed"]]},{"id":"03c88bda954f891c","type":"websocket in","z":"38bb52a74adab1df","name":"BLE-RC in","server":"","client":"8294c7d8a6eda105","x":140,"y":140,"wires":[["549524b40052046b"]]},{"id":"549524b40052046b","type":"function","z":"38bb52a74adab1df","name":"","func":"\nreturn {\n payload: {\n \"latency\": Date.now() - flow.get(\"start\")\n }\n};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":140,"wires":[["e7f1716f6037163f"]]},{"id":"e7f1716f6037163f","type":"debug","z":"38bb52a74adab1df","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":490,"y":140,"wires":[]},{"id":"8294c7d8a6eda105","type":"websocket-client","path":"ws://192.168.178.240:81/jsonrpc","tls":"","wholemsg":"false","hb":"10","subprotocol":""}]
Don't forget to update the IP in the Websockets
config node ;)
Thanks, I've flashed the firmware succesfull.
The latency witch the esp32 on wifi is between 55-130 and with eth its between 5-7. Very nice!
Great! But 5-7 seems to be too fast since the ble signal needs some time between 15 - 25ms. So... how?
Anyway... does it solve your problem?
Yes it solves my "problem". It wasn't a big problem but the BLE-Remote-Companion is now perfect for me! Thank you for your help and adding the hardware support so fast.
If you need someone to test...
Good to hear. It's not a 100% done yet. I have to test if it did break anything within the default environment. Especiallly the captive portal and WiFi initialization. If that works OK its ready to be merged into the main Branch.
Cool! Is it your design?
No, it is on https://www.thingiverse.com/thing:5215365
I created my own version and added it to the repo. If you plan to add a TSOP it could be useful to you.
Thanks for the suggestion. Was fun to add a new device :)
Maybe I'll do that for testing purposes.
With the BLE-Remote-Companion I can control everything over IP.
Thanks again for your effort!
Sorry for doing this tru this github.
I really like your BLE remote companion, have it on a ESP32 to control my shield over websocket. Is it possible to add hardware support for WT32-ETH01 so we can eliminate latency over wifi?