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

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

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.

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

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.

M210 DJI drone can't find UART pins

I am currently working on the serial communication on the M210 drone from DJI and I would like to test a programm using the serial communication. I know there are UART pins on the expansion ports but I cant find the documentation on the constructor's website to know which pins belong to Rx and Tx.
If someone has the information or knows where to find it.
Ps: I looked all the documentation on DJI's website about M210 and found nothing
Page 40 of the user manual you'll find this pin description:
I hope this helps

Getting disconnected from Chromecast after switching to custom receiver

I recently switched my Chromecast app to a custom receiver. I'm still using the Cast Companion Library. The custom receiver is basically based on this https://github.com/googlecast/cast-custom-receiver/blob/master/sample_media_receiver.html the only changes are the adding of a logo and loading screen and commenting out this line appConfig.maxInactivity = 6000; although at first I didn't have it commented out and still had the same issue.
Anyways the issue is pretty simple and only happens to a few people. It happens to me with one of my test devices, not all and not always. Basically I start streaming a video and it is all fine, then the device screen goes off, when I turn it off again the app has disconnected from the Chromecast. I do not have wifi set to turn off when sleeping, and all of the users who have complained about this claim their devices also don't have that setting turned on.
It could be a coincidence that this happened when I switched to the custom receiver but I just wanted to make sure there wasn't something I needed to add to my custom receiver to tell the CCL code to stay connected?
Thanks.
I faced similar issue today. Main cause for this behaviour is that as soon as the sender (in your case phone) is locked (sleep mode) then senderDisconnected event is fired on the receiver side. And if you check the event.reason, it will be unknow, so you could probably check for the reason, if it unknown then dont stop the playback on receiver (window.close).
When the sender itself disconnects, event.reason is "disconnected_from_sender".
I hope this helps.
It has nothing to do with maxInactivity.
The policy for disconnecting wifi when your phone goes to sleep does depend on the brand and vendor . Currently, the Cast SDK holds a lock to keep the wifi connected as long as there is a cast connection but even that is not a 100% guarantee to work for all phones/models/vendors/.... This has nothing to do with your receiver. The proper solution is not to try to fight against the wifi disconnect when phone goes to sleep, instead you have to consider adding some logic to recover the cast connectivity when phone wakes up and wifi connectivity is re-established (register a broadcast receiver to listen for wifi connectivity changes).

How to IP-Forwarding for Man In the Middle Attack

I`m working on a project about Man In The Middle Attack by ARP poisoning method.
In this project I need to work like as a router. For example suppose In My Lan there is two other device (a modem & a laptop). I says to laptop that I`m the modem to fraud it. whenever the laptop wants to send a packet to outside of the LAN, sends the packet to me!
All thing I need is I want to send the received packet to the modem & sends the response to victim laptop.
How can I do it programmatically?
Thanks a lot.
Ya Ali.
Well the first thing you need to do is perform the ARP poisoning attack. You can review how to do this in detail here.
One thing of note is that your middle-man PC must how be able to perform like a switch and forward out packets it receives in - It will be passing packets between the modem and the laptop in both directions.

Resources