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

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!

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.

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.

Xbee and Arduino acting strangely regardless of code

I'm trying to write a simple code that sends a string to an xbee and one that sends the string back, I was able to do this with XCTU via console, but I want my arduino to send the string.
I was able to use a simple code that read my output from the serial monitor and sends it to an xbee connected via usb adapter, the problem is that I now wrote the code so it sends a predefined string like in the screenshot, but when I write into the monitor it still sends whatever I wrote instead of the static string. I'm also unable to read what I type into the xbee console from XCTU.
I'd love any assistance in this, I've tried uploading and resetting everything to no avail.
Screenshot of problem with the current code of the arduino on the left
You said you were using an Arduino to try to communicate with your XBee Zigbee module.
One thing you have to check is the connection between the TX and RX signals on the Arduino side and on the XBee Zigbee side.
I've helped someone on another forum who used this Seed Studio XBee shield :
If you look at the schematics of this shield, the XBee 'DOut' signal (Tx) is wired to the XB_TX line which can be connected to any of the AJ2 pin with a jumper.
Now on the Arduino side :
On this extract of the Arduino schematics, we can see that the ATMEGA UART has it's RX signal connected to pin 2 of the CPU which is wired to the IOL (AJ2) pin 0.
So, that means that on this shield, the jumper have to be placed between XB_TX and pin 0 of AJ2 to connect the XBee transmission signal (output) to the ATMEGA reception signal (input) [and also XB_RX have to be connected pin 1 of AJ2].
As you didn't mention what kind of shield you were using, you have to double check this point which is a common issue when using serial communication.
In a general way, ALWAYS connect 1 output to N input (except open-drain or open-collector outputs which can be connected together to make a wired OR but which finally have to be connected to N inputs)
Hope this helps
Best regards
From what I can tell on the documentation Xbee "hijacks" the serial system. Instead try blinking an LED to confirm data is being received and sent.
documentation

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