using joystick on one raspberry pi to control input on second raspberry pi - websocket

I have a raspberry pi 4(let's call it server) that's operating servos and motors on a boat. I've managed to control the boat using another raspberry pi 4( let's call it client) and connect via SSH. First remote control was via touchscreen and gui that ended up pretty useless. I wanna try control by joystick which I've placed on client side. My problem is how do I implement the signal from joystick that I get from script on client as input signal on server side? Is there a way to do that via SSH or something else? In longterm there will be a camera, radar and sensors placed on the boat. Is the websocket best solution for that type of remote control?

Personally, I think I'd set up MQTT for this which is ideal for transferring short messages and doesn't require absolute "lock-step" communication back and forth. That means you can start in any order and the second half doesn't need to necessarily be present.
I'd install mosquitto on either RasPi, and then:
let RasPi with devices attached subscribe to a "joystick" topic so it gets all joystick movements, and
let RasPi with joystick attached publish each movement on that topic.
Enter [mqtt] in the StackOverflow search box for examples.
Alternatively, you could use Redis "pub/sub" just the same.
Enter [redis] in the StackOverflow search box for examples.

Related

FiPy gateway not receiving uplinks from Raspberry Pi Pico with sx1262 module LoRa node

I'm trying a setup for LoRa with a FiPy board as a gateway/forwarder and a Raspberry Pi Pico with the Waveshare sx1262-686m hat for LoRa.
The FiPy is listening on the 868.1 Mhz frequency (EU868) and it works fine with a Lopy class C node that joins with ABP. The node is forced to send its uplink packets on the 868.1 MHz frequency. It's not able to receive downlinks but it is fine for now.
These are the logs shown by the gateway when communicating with the Lopy:
txpk is packets coming from the Chirpsack network server while rxpk is uplinks coming from the node.
Then I tried to make the Pico communicate with the FiPy, using the lorawan library for pico developed by Waveshare for their hat.
The problem I'm facing is that the pico node seems to be sending out the uplink packets but the FiPy forwarder doesn't receive them. From the node logs it seems like it is sending out data just fine but nothing appears on the gateway. The module is of course switched on and the antenna is connected.
After using the LoPy-FiPy setup, I thought that the problem was in the frequencies used by the node that was sending data on the other frequencies, so I changed the RegionEU868.h file to force every channel on the 868.1 Mhz and use only the 3 default channels. But even though in the logs it is shown that the frequency is the desired one, the gateway still receives nothing.
I'm now trying to use a proper Kerlink gateway but if anyone knows where the problem lies (if any) help is appreciated.
EDIT: with the Kerlink gateway everything works fine, so if anyone knows a workaround for the FiPy it'll be appreciated.
I forgot that other than forcing the frequency there's the need to force the SF and the DR to the one that the gateway is listening to. So since the gateway is configured for SF7BW125 I changed the RegionEU868.h file so that every DATARATE variable is set to DR_5,that is SF7BW125.
It works as a temporary solution. I will now procede to create dedicated functions to change those values instead of hardcoding them.

Route websocket data through USB link to PC client (Android)

I have an issue where WiFi is not available on an Android device. We want to stream image data from the device using a websocket server (written using WebSocket++) through to the PC. However, I'm not sure if this is possible without operational WiFi. So, the position we are in is that we may only have the USB link available.
Someone today suggested we might be able to get Websockets working using adb port forwarding (see https://developer.android.com/studio/command-line/adb#forwardports), but I'm not sure if that's correct. Could this work, and what would that solution look like?
Are there any other reasonable options. I'm not certain if tethering is available on the device and if that could be another solution?

From WiFi to Cellular 3/4G on ESP32

I am building a project utilizing Wifi on the ESP32 module. Using RTOS, I am running a web server on 1 core and a web client on another core. This works very well and I can access the web server remotely via my browser and the WiFi provided IP address. The Web client reads some sensors and sends the data via WiFi to my database. All good and everything works as desired.
Now I need to do the next step and move beyond the reach of the WiFi and reproduce the same result via 3/4G cellular. I looked at the "easy" solution to use an industrial 3/4G WiFi router and simply keep what I have. Cost of these "industrial" type routers are on the high side, where as 3/4G module which also include a GPS chip are around half or less. Problem is that I cannot get my head around how I will "replace" my current WiFi functionality with one of these modules. The modules seems to expect you to connect via serial (rs232) and using modem AT commands establish a connection to the internet. Question is, after connecting to the internet, how do you continue to have "network functionality" same as with the built-in WiFi? Is there some library that will do ethernet over the serial port? Can I still have the WiFi and the "serial ethernet" running at the same time or switch between the two?
Thanks!

Is is possible to control %QX0.0 LED light through OpenPLC ModBus?

just started my OpenPLC journey and created my first project using the tutorial and was wondering is It possible to turn on the LED through a packet sent to the default ModBus server port 502 instead of pressing the button physically? I have been going in circles and would be happy to get any help and direction! Thank you in advance!
Setup:
1 X RPI 3 b+
1 X LED
2 X Button
Raspberry pi is installed with OpenPLC and project uploaded to OpenPLC. light turns on and off with the press of a button once PLC server is turned on.
Yes, it is possible. According to OpenPLC's documentation the Modbus Slave supports coil registers with read/write access.
Now that you know you are not spinning your wheels in vain here are a couple of things to check.
verify that your PLC logic is not telling that output to turn off which will override the Modbus request
verify that your Modbus master (the device which is sending your packet) supports functions 5 &/or 15

Using Sony Camera API on AndroidWear

I want to create an app that can start and stop recording from a Sony AS100VR camera using camera remote API.
I can get the same working from my nexus using a direct Wifi connection, but when I establish a direct wifi connection from my Sony smartwatch, it fails at the SSDP detection stage.
It's definitely connected to the camera, SSID over Wifi, but it can't detect it.
I have tried playing with retries and timeout values, but I have sort of run out of ideas.
it's falling into the catch catch (InterruptedIOException e) with a java.net.SocketTimeoutException
Any suggestions gratefully appreciated!
UDP Mulitcast is not available on smartwatch, so SSDP discovery fails.
There is a fail-safe choice for any UPnP based application, that is:
As in most case, the resource URL structure keeps unchanged except IP Address, so when SSDP discovery failed, let user directly input the IP Address (maybe in form of UI Picker) and get "DeviceDescription.xml" or something else then setup services.
Have you taken a look at the CameraRemoteSampleApp that comes with the Camera Remote API SDK? I assume when you say Smartwatch you mean you are using a Sony SmartWatch 3 that supports a direct WiFi connection? If so, you should be able to modify the sample app with minimal changes and run it on the SW3.

Resources