XBee two-way communication (sender and receiver) at the same time - java

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.

Related

How to connect java with plc data

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).

Communication Between Multiple devices.

I am designing a simple Android application (might be ported to iOS in the future) where I want to have real-time communication between multiple devices. The procedure is that one device(creator) makes a "lobby" that have certain ID, using this ID other devices should be able to join this "lobby" and wait for messages from the creator. Then clients connected to the "lobby" should be able to respond to the messages from the creator. The connection should only be active for couple of minutes and no need to store the messages on the server side.
I am not sure what methods I should look into to archive this functionality. I have looked at comet, but I am not sure if that is the way to go for this project.
Have anyone solved similar problem? And if so how did you do it and what libraries/frameworks did you use?

Combining Java + bluetooth + arduino

Today i came up with an idea to controle a arduino board or any other micro controller wirelessly using a java program. Im somewhat of an intermediate java programmer, meaning i can make basic applications. I know next to nothing about arduino, or the programming of microcontrollers in general, and i dont want to start to learn until i know i can link java with arduino, meaning running a program on the computer that, lets say, turn on a led. Ive done some research, and thats where i got the bluetooth from, but it seemed like the only videos were in spanish, and not much documentation about it, as far as i can see. I was just wondering how easy is it to link these two, is it possible, any links to tutorials of sorts, thanks. P.S. it doesn't have to be arduino, im just familier with that name, im just interested in controlling something physical through a java app, thanks.
Yes you can,
If you can program in java you will find arduino fairly easy but here is a arduino based tutorial with all the code your need:
http://playground.arduino.cc/Learning/Tutorial01#.UxClcvl_tFs
A majority of bluetooth modules will spit out serial data and this simply interacts with the RX/Tx (receive/transmit) inputs of the arduino. They are usually configured to standard board rates mainly 9600 to start.
All you have to do is spit a string out via bluetooth, an java based bluetooth example is below but you can also find bluetooth modules for PC that interact and install as a CDC (serial port).
Sending a string via bluetooth from a PC as client to a mobile as server.
Serial ports are a little easyier :)
http://www.java2s.com/Code/Java/Development-Class/COM-Port.htm
Cheers,
Chris

Linking an Arduino program in Java

I have written a program in Arduino to detect intrusion using an ultrasonic sensor. And when it detects intrusion, a camera must be triggered. I have written the triggering program in Java in the NetBeans IDE. But I don't know how to link the Arduino program with Java. I browsed many sites and came across the blog post Arduino and Java, but I got an error while running the program.
The error is at the line Preference.init() How can I fix this problem?
Your Java application running on some computer or board can communicate with your Arduino application via serial communication link. This can be RS232 for shorter distances (up to 30m if 9600bps is used), or RS485 for up to 1200m. You need touse some known protocol, or make your own. This link can also be wireless if needed. More complex would be to put bluetooth on both sides, if that is more convinient for some reason. Alternatively, if you have an ethernet shield for Arduino you can implement UDP or TCP messaging to notify Java application about Arduino events. Instead of sending an event only when it happens, you can also think about periodical polling from Java application.

Interfacing java and voip

We have a small java application running on windows that needs to be able to make voip calls with text to speech sent to mobile and landline numbers and needs to send sms messages.
The application will notify contacts of specific alerts.
I have been searching and searching the past few days and I still do not even know where to begin.
I really just need a "push" in the right direction.
Any links or technologies that you could list off would be appreciated.
Thanks.
First solution is using Java API for Skype. You can fully operate it using java API: originate and answer calls, send SMS (if user has skype credit).
Other solution is to create calls using Asterisk and send SMS using one of available SMS libraries (e.g. SMSJ).

Categories

Resources