Python - Read a GPS through I2C? How would I do this? - python

I'm trying to read data from this GPS through python. This GPS is hooked up to my Raspberry Pi 3 B+ via I2C. I need to use I2C communication, as my serial ports are going to be used by a different device.
So far my endless googling has brought me nowhere. I can't seem to find any python libraries that will let me do this. Can anyone here help me get started? Thanks!

Related

How can I connect two raspberry pi 4 to each other with bluetooth and make a python code that receives the message from one raspberry to another?

I have two robots and I need to connect them with bluetooth, so the first one can tells to the other to start the two DC motors(the wheels).
I looked at these two sites https://scribles.net/setting-up-bluetooth-serial-port-profile-on-raspberry-pi/ https://gist.github.com/keithweaver/3d5dbf38074cee4250c7d9807510c7c3
But I don't understand how to make the python script I need.
I would be very grateful if someone could help me.
Leeesa :)

How to get live plot data from headless Raspberry Pi?

I'm new to using a RaspberryPi. Until now I was experimenting with an Arduino.
If I connect an Arduino by usb it is recognized as COM device and with the Arduino serial plot software it was easily possible to live plot sensor data.
For my next project I want to work with an Raspberry Pi Zero W and Python.
Is it possible to send serial data from a python script over the charging usb-cable like with the Arduino? If not, what would be the easiest way to send sensor data e.g. to matplotlib to plot the data directly?
It is possible. However I would not recommend using the USB serial port profile. While it works, it is severely limited in comparison to the alternative. Which is using one of the various ethernet gadget modes.
One tutorial for setting this up is e.g. http://www.circuitbasics.com/raspberry-pi-zero-ethernet-gadget/
The result of this is a full network interface that you can not only use to transfer data over a TCP/IP socket but at the same time run a SSH-connection to start and monitor your application. Even to develop by using a SSH-enabled editor such as Emacs. So the possibilities are much bigger than over the single-stream serial setup.
If it absolutely has to be serial, that's of course possible too - follow e.g. this tutorial: https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/serial-gadget

How to use multiple Arduino boards with a single Raspberry Pi for sending and receiving data?

I am doing a project that involves using a Raspberry Pi to control all the switchboards in my house. I will start by wiring three switchboards first.
I am planning to use one 8-channel and one 2-channel relay for each of the switchboards, as each of these switchboards contain 10 switches. So, that amounts to 30 relay units.
However, I do not have as many as 30 free GPIO pins on my Raspberry Pi. I can use a port expander, but the Pi is installed with a camera and stationed near a door and fixed there. So, all the 30 wires from the switchboards need to be brought to the Pi, which will make the walls look messy. I was wondering if I could install an Arduino mini for each of the switchboards and control the relays using the Arduinos.
The Arduinos in that case need to the connected to the Raspberry Pi somehow such that when I want to switch on a specific light in my bedroom, I send a command to the Pi. The Pi sends the corresponding information to the Arduino in some well-defined format, like JSON, mentioning the switch number and the action to be performed. The Arduino switches on or off the switch and returns a message to the Pi.
Can this be done? I would be grateful if anyone could help me with this.
Thanks in advance.

Issue with raspberry pi serial port

I'm using raspberry pi 2 to control 2 types of printers. I found at this site how to send serial commands in hexadecimal format using python, like:
cmdTest=b"\x12\x02\x42"
ser.write(cmdTest)
This code works true for one printer but fail for another!
knowing that:
I test both devices using a normal computer and both works.
Both are from same manufacturer (ELTRASISTEMI).
I am using the appropriate commands for every printer
I am specifying the correct baud rate knowing that both are of the same baud rate.
My problem solved, Although something still not clear.
The commands were correct the problem is something related to the serial convertor I were using. Now I used a usb to serial convertor instead of a shield convertor and it works great with same code and same commands. Although it worked, I'm still confused why a printer worked with RS232 shield and other not.

Real time plotting of serial data between python and arduino

For the mapping of the obstacles in a region, I was planning on using Sharp IR range finders connected with an Arduino Mega and then trying to plot it in real time on a polar histogram type map using python and matplotlib. I was a bit confused about how to proceed through the interfacing of the Arduino and python over the serial connection.
Any help would be great.
Thanks
This might be a good start: Arduino and Python. Summary: use pySerial and read from/write to /dev/tty.usbserial.
See also:
How to send a value from Arduino to Python and then use that value
Receive multiple values via pyserial and display in Python GUI
If you are ok with skipping Python you can do the same thing in Processing. If you just manage to send the data wirelessly over for examble xbee or bluetooth then it would be a piece of cake to connect it to a plotting software like this http://sebastiannilsson.com/en/k/projekt/realtime-plotter/

Categories

Resources