Two way Serial Communication not possible with Qt and Arduino - qt

I am trying to do a sample application using Qt to communicate to Arduino board DUE.
But When one communication is started other is not able to connect,meaning when i start my Arduino first I am not able to start Qt application to read or write data and viceversa.
Can anybody tell me whether this is possible if Yes please help me in this and i ll try to post my sample code.

If I understand your question correctly, you want to be able to connect to your Arduino device (via its USB to RS232 converter) while the Arduino IDE, and thus, the serial monitor is running.
If that's the case, that is simply not possible. Not because of Qt, nor because of Arduino. That's the way serial ports work. You can't connect to the same port twice from different processes.
Since the microcontroller on the Arduino DUE has 4 UARTS, you may consider using one of them (with another USB to serial adapter, and thus, having another COM port showing up on your PC) to interface the board with your Qt application while the Arduino IDE is still connected to the "main" serial port.
Also, keep in mind that the Arduino Due works with 3.3 V, so ensure that the USB to serial adapter is compatbile with that voltage range.

Related

Communicate puredata with Arduino over Serial. Unable to connect to the same port for stablishing communication

As the title indicates, I need to create a bridge betweeen pd and arduino UNO but I can't get it to work.
I need to start an arduino process after receiving a message from my computer through puredata, using the comport object.
Since comport object in pd doesn't allow me to connect to the port used by arduino (listed trough "devices" message in pd) I don't understand how to stablish a communication between them.
[comport]: could not open device COM3:
failure(5) ERROR_ACCESS_DENIED
Arduino is connected to the computer by usb cable.
If been able to sort it out using in arduino.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1);
And then referring to the serial with the variable used, mySerial, in this case.
Since this moment, when I was trying to do it using a basic included Serial communication, without library, I was not able to find the needed port free in puredata. Now it seems to work well, I cannot figure it out why not before.

Arduino multiple serial/hid output

Hello has anyone found a way to use an Arduino as a serial device and hid device at the same time?
I thought of a few solutions but didn't know the best way to go about it.
my goal is I need a serial device so the computer can send info to the Arduino but I also need an hid device.
can I use them both though 1 USB port? probably not
or
can I rig up another usb or serial port on the Arduino and use that as hid?
or
should I connect the Arduino to a teensy and use that for hid?
Thank you just trying to find the safest solution I'm making a custom fixture for my little laser engraver.
I recommend getting an Arduino Leonardo, Arduino Micro, an A-Star 32U4, or any other Arduino-compatible ATmega32U4 board. These devices act as a USB serial port but they can also be an HID at the same time if you use the Keyboard or Mouse libraries that comes with the Arduino IDE.

Is it possible to use both external power jack and USB port with Arduino?

I have the Arduino UNO board and I want to know if it is possible to use both the USB connection (for exchanging data) and the external jack to power supply it.
I will use the following cable: http://ecx.images-amazon.com/images/I/41OMXaj5cPL.SY355.jpg with a AC-DC 5V adaptor in order to power supply the Arduino. However, I want to use also the USB connection in order to send some data from the computer.
Both will be connected at the same time.
In short, I want the Arduino to be able to run even if the computer is OFF and whenever I open the computer to send data to Arduino from USB connection.
Is this possible? Will the Arduino Uno board support it?
Yes. From the official Arduino website:
Power
The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.
External DC power will override USB power if the Arduino detects it. [Source]
as other said, it is absolutely possible to have both usb and power jack plugged in.
but be aware that if you shut down your computer and turn it on after, when reading the usb port you'll restart the Arduino and might loose important data.
yeah both of them can be used. If you want to upload the code in arduino then simply use the usb cable otherwise keep it on adapter. it wont harm the device.
What I personally do is, I keep on plugging the adapter and remove the usb once I am done with uploading and then test it as normally the usb cable is quite small and I normally work on robots so I need long wires.
if you want just plugs it in, it's ok but Arduino board will chose one and usb has priority to other power source.
********* Very important :*****
if you are controlling other circuits, that are connected to an external power supply, with your Arduino and connecting it to your PC's usb, Arduino will have potential difference and it will cause current flow that will damage your PC and Arduino board. if you want to do such thing, you have to shield your Arduino board from your other circuits that you want to control and they have external power source. this could happen with optocouplers for digital ports, non signal analog ports with shield relays, and complex analog circuits for analog signals

How to send/receive serial communication

How can I send a string via serial communications from Java or Python? I have a very little arduino program that will recieve a CSV string of ints that each control different relays (I adapted it from their example).
I just got an Arduino, and I am trying to use it to open and close a relay remotely. I have it opening and closing the relay, no problem. But I really have no idea where to start as far as using serial communication.
I have a bluetooth dongle that I can connect to, but once I do that I'm lost.
Also, this is my first time using serial communications AND my first time using an Arduino. So I'm sorry if I am completely off on some of the things I am asking. All I know is what I've learned from Google.
Thank you very much
You can use any Java or Python serial port classes and methods. There is however one thing you need to be aware of.
The newer arduino's have a feature known as AutoReset. This works by connecting the DTR signal from the serial port to the Reset line on the chip using a capacitor or such. The IDE uses this to reset the board to activate the bootloader and initiate uploading code to the arduino. The serial monitor in the IDE is aware of this and does not toggle the DTR line when comunicating with the device (except when it initially connects).
There is are several ways to defeat this feature and you can read about them here.
As for actually comunicating with the device, there are several tutorials about serial communication in both Java and Python.
Pyserial includes the option to not use the DTR lines when opening a port.
Here is a website explaining how to use RXTX (a Java library) to comunicate with an Arduino
Best of luck.

WinUSB driver for Arduino

I'm using an Arduino to read data from the web and display it. I can easily pass the data as serial using the supplied drivers, because they identify the COM port so I can send serial to the COM port.
However, I want to use 'real' USB techniques so the device can be plugged in and out like a normal USB device. I'm looking at using WinUSB as the driver. However, USB is all new to me. Is there an .inf file that uses WinUSB and an Arduino (I have an Uno)?
The lack of information on this is making me think I am going about this incorrectly.
Turns out that an Arduino Uno is not a genuine USB device.
It acts as a Serial to USB adapter. Consequently USB drivers don't talk to it.
I got round this by writing a sketch which reported back what device it was when it got the correct query from the PC.
On the PC I just iterated the Serial ports and sent the query to each port. The one that replied was the Arduino.
After that I record the port number and send serial data to the Arduino.
To learn the USB portion, maybe you could combine V-USB and the UNO?
Check out V-USB.
V-USB is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip.
While not necessarily Arduino, it may provide you the learning exprience you want, and let you use incorporate your UNO device.

Resources