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

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.

Related

How can I convert serial data into an I2C readable format using the Mikroe RS-232 to I2C click

At a high-level, I am trying to convert serial data coming off of an RS-232 cable so that an I2C device can read it. I am not married to any one component or solution but the transmitting device, a voltage controller, will only send via serial, and the receiving device I want to use only supports I2C.
More specifically:
I am using this PC meterbus adapter to get data off of a voltage controller, and the output format it supports is RS-232. I have an IoT device that uses a Feather S2 board as its control unit, and I basically want to send the data coming off of the voltage controller to the cloud using that device. It only supports I2C via a little header that the feather S2 plugs directly into.
So, to recap, we have an RS-232 cable plugging into this Mikroe device. The device connects to a Feather S2 board using the SDA and SCL pins. The problem I'm having now is that when I run a sketch to detect connected I2c devices:
import time
import board
i2c = board.I2C()
while not i2c.try_lock():
pass
try:
while True:
print(
"I2C addresses found:",
[hex(device_address) for device_address in i2c.scan()],
)
time.sleep(2)
finally:
i2c.unlock()
It's returning:
I2C addresses found: []
I can't get any useable data from my voltage controller if I can't even get the board to detect the serial to I2C converter.
I've ruled out bad soldering, no pullups, etc. I'm thinking maybe this device isn't appropriate for this use-case and I need something else, or, having read the datasheet, maybe I need to send some sort of start condition from the feather to the I2C click to get it to start transmitting.
If that's the case, I'm at a loss, because I've never interfaced with an I2C device NOT using a circuitpython library for that device. I tried looking at Mikroe documentation, but it seems like that community doesn't support Python. Does anyone have any suggestions about where to begin? Either a different module to use for my serial-to-I2C conversion, or some python approach to coax the Mikeroe module into playing nice with my Feather S2.
Thank you for reading my question! I appreciate any and all help!

Two way Serial Communication not possible with Qt and Arduino

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.

FTDI + ESP8266 [Need to use AT Commands] without Arduino

I am trying to write standalone ESP8266 code so that it can communicate to wifi and change its states. For this, what I want to do is to send some command "AT+CWMODE=1" or "AT+CWMODE=3" to ESP8266 via code and toggle them on push button tap.
So, like in Arduino there is a Serial.write which writes on a serial monitor via SoftwareSerial class.
But when I am sending Serial.write("AT+CWMODE=1") it prints on the monitor as a string rather than changing the wifi state.
Is there a way to send AT commands without using Arduino chip software serial pins?
Thanks.
Sorted out the issue. All those who are new like me to ESP world, I did the serial.write "AT" commands using wifi classes of Esp8266.
You need to connect the board as ESP8266 Generic Module and send/receive data using ESP8266Wifi class, by reading the scanned networks, changing mode, using Serial.read on the connected devices on Access point of Esp8266.
Let me know if someone need help on this future, I will be happy to help.

Arduino Yun WifiStatus Example Failing

I am able to connect and upload the WifiStatus example per the instructions on the Arduino Site/Examples/Yun. However, when I hit the serial monitor button it is supposed to print out the relevant Wifi stats, instead it says "unable to connect" and the final line goes a bit further..."unable to connect: is the sketch using the bridge". Any ideas? A post suggested reseting the 32U4, which I did, but no luck.
Incidently, all of this is over Wifi. Board and port are set per instructions. Yun pings fine and receives the uploaded sketch fine.
More code is usually more illuminating... so you might get better answers when you provide more information.
"is the sketch using the bridge" seems to indicate that there is some problem with the Bridge library. Is it being initialized? Did initialization (i.e., "Bridge.begin()" succeed?
A sketch with bridge functional and serial monitor via network connection cannot be running simultaneously as they use the same hardware connection.
You may use the serial monitor via USB port, or Serial TX/RX pins, or SoftwareSerial for this.

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