I am trying to communicate with a temperature humidity readout unit, a Fluke 1620, using a Raspberry Pi Pico W. Ultimate goal is to log data and make it available on our work network. I wanted to test the UART connection but I get a null response when I run the code. Here is the code I wrote.
from machine import UART, Pin
import time
uart1 = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))
uart1.write(b'*IDN?\n')
time.sleep(0.25)
rxData = bytes()
while uart1.any() > 0:
rxData += uart1.readline()
print(rxData)
The response I get is b'\x00'
I will admit I am pretty new to Python and haven't written a real program in many years but this in my mind should work. I've written a normal Python script very similar to this and received a response. Can anyone tell me where I'm going wrong?
Related
I'm working on a BMS project for an electric car. I'm using LTC6804-2 for voltage and temperature measurement in each cells. As a first step of development, I would like to establish a successful communication with the monitoring IC (LTC6804-2). So, I'm sending set config register command and trying to read back the config register values that I have written. If I receive the configuration register values without a CRC error, I consider my communication as successful.
In my case, I do not receive expected register values with proper CRC when I read back. Let me break down my situation into small segments.
I'm working on a custom BMS board for this project(LTC6804-2 and STM32F072). I will attach the schematics below. To test my code, I tested my program with DC1942C demo board and arduino UNO. And it is working fine. I can read back the config register and I can calculate the cell voltage and Auxiliary values.
When I try to implement the same program in my custom BMS board, I'm not getting the correct values. I always get CRC error in the received data.
Following the guidelines from the Analog Devices forum, I tested the Vref2 value after sending the config register command, and the voltage goes up to ~3V as expected. So the IC is receiving the message properly. But Why it is not transmitting back?
Below are the captures from the demo board and BMS custom board.
Register read capture from Arduino Uno and demo board DC1942C
Register read capture from the custom board
In fact I tested the program with STM32 development board and DC1942 demo board, I get the correct values.
Thank you for your help. If you want any additional details, please let me know.
LTC6810-2 datasheet
I am working on interfacing of SIM7600E-H (A GPS + LTE Module) with Arduino UNO over UART using AT Commands. The high-level plan is to acquire longitude and latitude using IZAT feature and transmit them over LTE to data-server.
Development Board: Arduino UNO with UART using <SoftwareSerial.h>
First, I am getting GPS data using IZAT GPS feature, the acquired data is then bifurcated to get actual longitude and latitude position. Then, creating a data-string comprises POST request and acquired longitude & latitude data. The data-string is of 217 bytes. This data-string is then transferred to SIM7600E-H using command AT+CIPSEND and a terminator - 0x1A. Now, as per AT command set manual, +CIPSEND command should return the received bytes, but it is acknowledging with 0,2,2 instead of 0,217,217. Now, If we follow the same steps for Standalone GPS instead of IZAT GPS then we are getting successful acknowledgment with 0,217,217 and data is also getting posted on data-server.
Further tested, with IZAT GPS feature enabled, I found out that I am able to transmit around 150 bytes only, when using +CIPSEND command. If I am adding some more bytes then it is again acknowledging with 0,2,2.
Prior doubt was if <SoftwareSerial.h> is creating this problem or not?
So, I tried with <AltSoftSerial.h> and even with Hardware serial on DIO 0 & 1. But problem still persists.
So, I facing this kind of issue with +CIPSEND command when enabling IZAT GPS feature.
Serial monitor outputs when using IZAT GPS and Standalone GPS separately:
Can anyone please explain how to establish a communication between stm32 dev board and gps module? I am not knowing how to send AT commands to gps module through MC through a source file through UART. Please clarify me in this aspect.
There is a lot of literature on STM32 and UARTs on the web. If I were you I would download the STM32CubeMX. This program generates most of the code for you. You select your processor (or development board), select the clocks and peripherals, and click Generate Code. It also comes with very handy example projects, and might even have a complete project with a working UART that you can put straight onto your board.
And I would first make sure my UART is fully working before connecting the GPS. This you can do by trying to echo. Connect your TX and RX pins with a wire. Then, everything you transmit you will receive as well. It's a easy test to see if everything is working.
I would also work through the TrueStudio IDE. It basically works plug and play
If you use the ublox module, you must use a serial port to communicate.
You have to connect RXD(ublox) to TXD(micro) and TXD(Ublox) to RXD(micro) ,
and config your StmCubemx like This :
http://wiki.sunfounder.cc/index.php?title=Ublox_NEO-6M_GPS_Module
Config Stm32 :
[Step 1: https://i.stack.imgur.com/1B4Ed.jpg ]
[Step 2: https://i.stack.imgur.com/6ULOm.jpg]
[Step 3: https://i.stack.imgur.com/GD0VL.jpg]
If you have another question, please ask
First of all, I think you should test AT command with module sim through (USB to UART) to PC in order to understand procedure operation, such as: module sim - TCP/IP - thingspeak server. The next time, you can refer this link for code: https://bitbucket.org/mbari_peter/sim800-mqtt-ravi/src/78e36076c89b4618cf57a538f0c70f91b2b876dd/modemDrivers.ino?at=master&fileviewer=file-view-default
If you have any questions or encounter any problems, you can ask! Thanks for reading!
Typically, GPS sends data # 1 Hz after starting up. You just need to capture this NMEA sentences and filter the receive buffer according to your requirement.
Try using UART receive interrupt. Make sure the baud rate of both GPS module and STM32 are same.
I have an infrared thermometer which operates on a virtual serial port over USB, which I am trying to use on a Linux intel and next on a raspberry Pi. The system did not enumerate a /dev/ttyUSB device.
I found a piece of a solution here :
Cygnal Integrated Products serial port on Linux
I reprogrammed the product_ID and can now see it as /dev/ttyUSB0.
But trying to talk to the thermometer with minicom doesn't work.
minicom keeps saying "disconnected" despite the "9600 8N1" indication.
I must say, I had many attempt to work with this kind of communication over USB/serial adapter trying using many different terminal emulator like screen or minicom but without any success at all !
I'm not even sure about the right way to send request and receive data.
Here is the documentation I'm using trying to talk to the thermometer :
http://www.optris.com/interfaces?file=tl_files/downloads/Manuals/addendums-de-en/ct-ctlaser-commands.pdf
Edit :
I'm now trying to use PySerial Python library in a Python script with an Arduino as a target (to act as my thermometer, the arduino runs a simple code that takes the data received and send them back to my Python console.) But still, there is so many confusion possible between ASCII, Hexa, binary, that I'm not capable of debugging anything as I don't know where the transformation between different format takes place !
The communication is working as I can get some data forth and back from my Python console through the Arduino. But I can't get sending hexadecimal data and getting any response back in hexadecimal format. + You say "Your latest question puts you in the off-topic category. ", what do you mean ? Sorry of being so confused.
I have a Raspberry Pi 3 with Android Things running on it, and I'm trying to write an application that makes use of UART serial. I used the sample code in Android Things documentation for sending data, and it worked perfectly, but the code supposed to receive data returns empty bytes.
while ((count = uart.read(buffer, buffer.length)) > 0) {
Log.d(TAG, "Read " + count + " bytes from peripheral");
}
There's an interrupt for when the UART buffer gets some data in, and that gets triggered calling the reading function, but reading the buffer returns nothing but zeros. In fact the loop isn't even entered at all.
I'm using a 5V FTDI Cable with a 5/3.3V Level shifter to send and receive data from the Raspberry.
How can I fix this?
Raspberry pi 3 has some issue with uart, check these answers:
UART peripherals on Android Things for Raspberry Pi 3
Uart / GPS driver sample buffer overflow
Use Docklight to verify UART data with the help of USB-TTL Converter.
Check all the Connections like
Tx -> Rx
Rx -> Tx
GND -> GND
.
Send data from Docklight.