I'm trying to create an android controller app that will send seekbar data for a steering wheel, brakes, and throttle to the raspberry pi. I've been using TCP/IP over ethernet to communicate with the pi, but I need a way to identify the different data streams associated with the seekbars. I've looked into JeroMQ, and Java Object Serialization but would like to get some suggestions. Ultimately, I need to send, and receive data to/from the Pi, essentially, the data needs to be synced, so that if, let's say, the steering wheel moves in the Pi program, the android also receives that data, and vice versa. Thanks Wizards.
The solution is to use a framework like MQTT or JeroMQ(ZeroMQ) to send the messages, either one will allow you to publish and subscribe, so you don't have to worry about creating a parser, this works particularly well when you need data being communicated bilaterally.
JeroMQ
MQTT
Related
I'm working on creating an Android app that will act as a controller for a robot I'm building for my kids. I just want to be able to turn it's head, and move it's arms. I was experimenting with TCP/IP earlier, and was able to send data from my phone to my Raspi. The issue I'm confused about is how to go about parsing the data. Currently, I'm just dumping all of the data into one stream from the phone, is there any way to send data for the head turn, and the individual arms as separate streams, and then send them off to the robot?
Why don't you use any popular format like JSON or XML for this like
{"command":{"type":"head","direction":{"up":"2","down":"0","left":"0","right":"0"}}}
And parse it in the RPi
I have a new project about plc (siemens), but I dont know how they work.
What I have to do, is by given some data from the plc I have to handle the data and to display it on a simple GUI.
The PLC (I dont know if there are different types) that I have to use is a "proximity sensor" which only capture if something is infront of it, then it hasto send some data to my program in Java and then I have to display it on the GUI (Basically some red or green circles)
I dont have to handle the behavior of the PLC, I just have to do display a red or green circle by given the data from the PLC
Questions:
I thought of Java because I know that is a powerful language, but is it the best for what I have to do?
Second if Java is the best choice, are there any librarys for working with PLC?
Third... I started to read something about some languages like:
Functional Block Diagram (FBD)
What are they for?
"The PLC(...) that I have to use is a "proximity sensor" which only capture something in front of it."
Do you mean to state here that you are connecting a proximity sensor to a PLC, reading the data from the PLC and back to your UI program OR do you want to read the proximity sensor directly back to your UI program?
If it’s the latter connect your sensor to a microcontroller and then send the data serially to your computer.
If you are using a PLC you will need some interface card (i.e. digital or analogue). Connect your sensor to the applicable card. If you want to read an S7 PLC you will need a library - libnodave is a good one.
If you are using a library like libnodave you will need to use ones of its supported languages - it includes Java but you can also use others e.g. C. You could also use Snap7.
FBD is one of the IEC61131-3 programming languages - see:
http://www.automation.com/pdf_articles/IEC_Programming_Thayer_L.pdf
The PLC should have an RS232/485 interface. All communications happen via serial communications. Java does have the Java Communications API, But before you go down that path, What is the computer that would be interfacing with the PLC device - A low power ARM SBC or a x86 PC ? The downsides of using Java is the footprint related to the JDK. If it were me, I'd stick to C/ Rust or GoLang based on the constraints of the platform.
To communicate with a Siemens plc you could use a few different options based on the exact type of PLC that you use.
A few communication protocols supported by Siemens:
opc: the industry standard for communication between PLC and other devices
libary like Snap7 http://snap7.sourceforge.net/ which has lots of supported programming languages
for the programming language you can use Java but as alternative you could use C# or vb.net in cooperation with Visual Studio for creating a simple GUI.
If you need any further information please let me know.
i had similar problem and this is how i sorted it out:
Communication protocol that most PLCs are using are either modbus, bacnet, lonworks and milion others. In your case , i assume that Siemens uses modbus.
Firstly you neet the Rs485 to usb adapter (arround 20Eur on Amazon)
you have to read registers from modbus - please use easyModbus api
This approach works fine but it is not happening in the real time as the modbus communication could run in separate threads.
This depends on the application that you want to design, if the application is based on the web, it is better to use a easymodbus TCP that sends data through TCP connection, and if you want a desktop application, it is better to use Easy Modbus RTU that Using RS485, this library it's the best.
http://easymodbustcp.net/en/
I Recommended to use this library it's also for future (Smart Phone, Desktop and Web Application using Spring Boot MVC).
I'm currently working on a Modbus TCP JAVA project using the jamod library. So far, I'm able to read & write to the Modbus network (gateway & some sensors from 4-noks) without any issues. My next step is to receive the data of the sensors automatically.
The devices I'm using are sending their registers to the Modbus-Gateway at regular intervals (about 20-60seconds). Unfortunately, I'm having some problems in receiving these data.
The Gateway has a register in which it's counting the received messages and it does receive data of the sensors, but how can I display these data onto my PC using java (jamod, or maybe another library)?
I have been searching and trying for the last week and I'm out of ideas. Would be very nice to get some information on how this goal can be achieved!
It depends how you want to display the data and what your intentions are.
On the full-solution end of the spectrum this is what an HMI/SCADA system does for you (www.inductiveautomation.com, for example).
On the roll-it-yourself end of the spectrum it sounds like you just need to continually poll the gateway for the registers you're interested in and maybe display it on a webpage.
Where do you land on this spectrum?
Let's say I am trying to make a chat program like in the YouTube video XBee Basics - Lesson 2 - Simple Chat Program Between Two XBees in AT Mode.
In this video, he explained that one XBee is a sender which sends "Hello world" to the another XBee using Arduino.
However, is the XBee able to send and receive data at the same time? Are the routers able to communicate to the coordinator and the other way around?
Additionally, I want to write my own software to receive and send data and not using Arduino software. Are there any libraries and APIs?
Articles or videos would be nice.
Yes, it is possible to send and receive data at the same time. When XBee modules are configured in "AT mode" (also referred to as "Transparent Serial"), you configure the DH and DL parameters to identify the destination node that will receive the serial data.
You should definitely spend some time at examples.digi.com for step-by-step tutorials on setting up various examples like a two way chat. The Quick Reference page includes a long list of libraries in various languages, including the Digi XBee ANSI C Library for C and xbee-api for Java.
I would like to develop a application that when used between two phone we can send exchange data(like e-visiting card). I intend to develop it for all smart phones even those without NFC. I am just a budding developer and would like to have some references about the possibilities of such an app. i have seen BUMP but i do not intend to maintain any server and would like to create a temporary network between the two phones and terminate it after the transfer. So is there any possibility in developing such an app?
Thanks in advance
Depends on the size of the data, but one possibility that comes to mind is the use of QR codes.
http://en.wikipedia.org/wiki/QR_code
You could try using a library like zxing (https://code.google.com/p/zxing/) to generate the qr codes.
Basically the phone wanting to send the data generates a qr code representation than the phone wanting to read the data reads the qr code with its camera and translates back to the original data.
I think you should try to use bluetoolth or local area network.
I pefer LAN.
In your app , you can set one app as server, another app as client.
make a socket connection and send your data.