Questions tagged [python]

On-topic questions related to Python would include embedded programming, using it as a tool for circuit analysis, or how Python interacts with computational hardware. Questions about libraries, algorithms, syntax, or code optimization should be directed to stackoverflow.com.

54 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
1 answer
185 views

FSK Modulation in Python

I am currently writing a script that uses I/Q data to do FSK modulation. My question is about the FFT plot. I expected to have a peak at 1Hz and 2Hz which are the frequencies that represent binary 0 ...
PrematureCorn's user avatar
2 votes
0 answers
118 views

Logging data from High Precision AD/DA board using Raspberry Pi 3B

I have a High Precision AD/DA board from waveshare with Raspberry Pi 3B (running on Raspbian). However, I can write only 27 samples in 1s in my CSV file. I am using this Python code for writing to a ...
Varun Dhankhar's user avatar
2 votes
0 answers
100 views

Get alpha-beta plot of Clarke Transform in Python

For a project I'm working on, I want to use the Clarke Transform to detect faults in a power system. To do this, I already wrote a script in Python which returns the sine wave behavior of the Alpha, ...
Juan Pablo Naranjo's user avatar
2 votes
0 answers
102 views

How do I control the speed of a simple DC motor based on the output of a machine learning algorithm using a Raspberry Pi?

Let's suppose there is a simple machine learning algorithm for detecting speed limit signs using image recognition and it detects a 30 km/hr sign. Is there any way to send instructions to my motor ...
Shaun Jacob's user avatar
2 votes
0 answers
224 views

Null characters in output from USB

I'm getting null-bytes in the output from an Arduino Mega 2560, when delaying reading from the USB buffer for e.g. 5 seconds. Can anyone explain why this happens and what I can do to mitigate the ...
Jeppe's user avatar
  • 151
2 votes
0 answers
51 views

Rx buffer overwrites Tx buffer in spidev xfer2

I'm setting up a comms link between an STM32F407 MCU and the Pi3B+. The code shown below works but when the data is printed out, it looks like the RX buffer overwrites the TX one. How do I stop that? ...
user3418620's user avatar
  • 1,330
2 votes
0 answers
336 views

How to calculate the Samples per second possible of a ADC (MAXIM 11605) using i2c with raspberry pi?

I would like to find out how many samples per second this ADC im using is capable of with a raspberry pi using i2c and python SMBUS2 library, but i dont know where to start. As far as i know this ...
BetweenBeltSizes95's user avatar
2 votes
0 answers
109 views

Trinket M0 PWM ValueError: duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)

I'm trying to control a servo motor from a Trinket M0. My circuitpython code is: ...
garys's user avatar
  • 99
2 votes
0 answers
1k views

PV cells (photovoltaic) I-V curve plot simulation

I am trying to plot the I-V curve using python because that helps me in understanding PV cells / solar panels (and diodes as a general thing). I know the formulas ...
TPPZ's user avatar
  • 121
1 vote
1 answer
123 views

How to PID control a 47 Ω, 8 W resistor with a Raspberry Pi and Python?

I have a Raspberry Pi 4B, a 12 V power supply, a 12 V air pump controlled by a MOSFET, a DS18B20 for feedback and a 47 Ω, 8 W resistor that we should somehow heat. Everything up to actually heating ...
Mito's user avatar
  • 411
1 vote
1 answer
106 views

DMU11 IMU data straight from port with Python

This is my first python project away from learning through textbook exercises. I have no other experience coding so sorry that the formatting is likely horrendous. I'm using DMU11 form Silicon Sensing ...
GracefulMango's user avatar
1 vote
0 answers
182 views

Stepper motor has own encoder, can I connect encoder pins to microcontroller and see feedback?

I am using closed loop stepper motor with motor driver. Here is my driver CS-D808. I am using this with microcontroller. I want to stop this motor always certain location after 5 to 10 turns. I wrote ...
Tryingtogetsome's user avatar
1 vote
0 answers
974 views

How to run LTSpice from terminal in Linux?

I've installed LTspiceXVII on my linux machine and it is running fine, but I cannot get it to run a simulation using the terminal. This is a necessity for me since I want to automate a circuit via ...
Al-Baraa El-Hag's user avatar
1 vote
0 answers
410 views

Dac over raspberry pi spi troubleshooting

I am trying to output a signal with dac124s085 from python code on a raspberry pi 3b, running Raspbian Stretch (kernel 4.14.30-v7+ #1102). I am sure the spi master driver is enabled - dtparam=spi=on ...
coffeeandcigarettes's user avatar
1 vote
0 answers
526 views

Solve \$n \times n\$ rectangular grid of resistors for mesh currents

I am modeling a mechanical process by using an electrical analogue. I need to calculate the loop (mesh) currents, then I can see if any mesh current is greater than a predetermined value \$\lambda\$. ...
Lewis's user avatar
  • 45
1 vote
0 answers
351 views

Problem with Pyserial read time

I'm building a RS485 network with rpi3 as master and a bunch of c51 mcu as slaves. After sending an address, the master waits for the slave to respond and then starts to send data. I'm using Pyserial ...
gordon's user avatar
  • 47
1 vote
0 answers
219 views

What are the materials needed for boiling milk alarm sensor?

I have recently bought raspberry pi to start working on it. I have never ever used it before. I am thinking of doing very basic task of led bulb on/off for getting into it. I am curious on developing ...
pri's user avatar
  • 111
0 votes
0 answers
50 views

Real-Time Audio Processing

this is my first post on here so I hope I am in the right directory to ask this or if there's another channel I should sent this in, let me know. Basically, what I am trying to do is use a sound ...
Cole Sheyka's user avatar
0 votes
0 answers
21 views

LSM6DS33 IMU data not behaving as expected

This is my first project using an IMU and I don't know what I am doing wrong. I am using an LSM6DS33 connected to a Raspberry Pi via I2C. When it is sitting still I would expect the gyro values to not ...
ThatAintWorking's user avatar
0 votes
0 answers
17 views

Data transfer between computer and Fieldfox N9917A using Python VXI-11 library

I accessed my Fieldfox device using the vx-11 library. But now I don't know which commands to access the data with. For example, with the CALC:FEED:MODE AVER command? I use Fieldfox programming guides ...
aycansgn's user avatar
0 votes
0 answers
45 views

Optimise matrix inversion in python for impedance calculation

To get the impedance profile for a circuit, I am using its admittance (G) and capacitance (C) matrices. I am using python to compute impedance profile at different frequencies but the issue is that I ...
Dev's user avatar
  • 51
0 votes
0 answers
21 views

How to perform image windowing on the OV5647 CMOS sensor?

I have an Arducam 5MP OV5647 Motorized Focus CMOS camera module (which is the same as a regular 5MP Raspberry Pi Camera, but with a motorized lens for manual focusing). https://www.arducam.com/...
F16Falcon's user avatar
  • 292
0 votes
1 answer
99 views

Unable to clear faults on Monoblock via RS232 command: Need help decoding serial messages with Arduino

I recently purchased an XRB160PN192 Monoblock with a known fault of high voltage (HV) for a low price to use in my graduation project. After reading the user manual, I found that the HV error, along ...
Amr Sohil's user avatar
0 votes
0 answers
73 views

HC-06 module does not receive data RP Pico

So I have a project that I currenty working on and I am also using the HC-06 module as a part of the communication proccess between the ...
David's user avatar
  • 1
0 votes
0 answers
76 views

Demodulation of IQ signals from SDRs

I am writing a Python program for an SDR in which I need to process the signal that the SDR will receive. My problem is that the SDR provides an array of complex values, which is tantamount to using ...
electronsx's user avatar
0 votes
0 answers
65 views

How to determine which I2C commands to execute to arrive at a desired result?

I have successfully established bidirectional communication between a featherS2 board and a Mikroe UART to I2C bridge. I do this by instantiating the address of an I2C command from page 16 of this ...
Z-Man Jones's user avatar
0 votes
0 answers
106 views

What do the \$E\$ and \$B\$ fields look like around a length of pipe, excited from one end by a Class A amplifier?

Diagram here: I'm looking for help modeling the \$\mathbf{E}\$ and \$\mathbf{B}\$ fields around a length of pipe. One end of the pipe is connected to the collector of a transistor in a Class A ...
seanlogan's user avatar
0 votes
0 answers
72 views

Siglent SDS Oscciloscope VISA disconnection

I'm currently connecting my Siglent SDS1202X-E Digital Storage Oscilloscope to my lab PC using a USB cable. I took advantage of the VISA interface that it has and used PyVISA package to write script ...
JackyWang's user avatar
0 votes
0 answers
95 views

Custom PCB with ADC for monitoring Lifepo4 battery bank voltages

I designed a custom PCB board to allow me to monitor the individual battery cell voltages in my Lifepo4 48v battery bank. Here is a schematic of the PCB: Basically I'm using a molex micro fit junior ...
NomNomCameron's user avatar
0 votes
0 answers
44 views

How to implement "burst" functionality for bare-bones function generator

Some fancy function generators have a burst feature which gives precise control over on-time and periodicity of the desired waveform. Ex: For my application, I have a 25 MHz sin wave (2.5 Vpp) and, in ...
Landon's user avatar
  • 167
0 votes
0 answers
239 views

CircuitPython & ESP32-S2-Saola boards returning code 43 errors

I am currently trying to connect to some ESP32-S2-Saola devboards that are running CircuitPython 6.1.0 via the USB OTG pins, but the device shows up as as "Unknown USB Device (Device Descriptor ...
Azias's user avatar
  • 1
0 votes
0 answers
31 views

Switching Circuit from Arduino to Raspberry Pi (Reading Analog Values)

I have wired up this circuit from learn.parallax I have wired this up to an Arduino and it works exactly how I want it too. This is the code that I used to get it working (also from parallax): ...
Berchell's user avatar
0 votes
0 answers
187 views

Tracking location with GSM tower triangulation

I want to track location with GSM tower triangulation. I searched and I found this API for GSM positioning. ...
Sun's user avatar
  • 1
0 votes
0 answers
179 views

Unable to read output of a joystick on a Raspberry Pi

I connected my joystick with this tutorial: link However, it does not work. The code runs fine (after changing print "---" to ...
MBee's user avatar
  • 1
0 votes
0 answers
62 views

Segments not totally off when multiplexing 7 segments display with CD4051BE

I'm trying to make a display with several 7 segment displays so I decided to use multiplexing to make it work. I use CD4051BE to do that. The circuit is as follow: Circuit of the multiplexing The ...
Sigma's user avatar
  • 1
0 votes
1 answer
727 views

ESP32 WROOM switching back from MicroPython to Arduino framework

I have recently switched my ESP32's firmware to work with Python (using Thonny IDE) and I want to switch back to work with C++ and the Arduino IDE, but I remember flashing that bin file on the device. ...
Jhon Margalit's user avatar
0 votes
0 answers
168 views

Are my charging equations being used correctly in my lithium ion battery Python simulation?

This is a continuation of a previous question I asked (Are my equations correct for a simple lithium ion battery model in Python?). My issue now is I do not believe I am using the charge equations ...
W. Churchill's user avatar
0 votes
0 answers
2k views

Are my equations correct for a simple lithium ion battery model in Python?

I am trying to create a simple battery model in Python based on the RC circuit from, http://firsttimeprogrammer.blogspot.com/2015/07/electric-circuits-101-rc-and-rl-circuits.html. I have attached ...
W. Churchill's user avatar
0 votes
0 answers
171 views

Raspberry pi not getting any data from hx711

I'm trying to combine two boards into one: SparkFun Load Sensor Combinator(basically just a wheatstone bridge) and SparkFun Load Cell Amplifier. The data will be transmitted to a Raspberry Pi 3 so ...
Corentin F's user avatar
0 votes
0 answers
87 views

need help deciphering accel/gyro datasheet for i2c communication using python RPi

I have barely any knowledge in this area, the most I have done is used my RPi3 with pre-built python libraries for sensors such as ADS1115 so I didn't have to go through the process of understanding ...
Derek Eden's user avatar
0 votes
0 answers
261 views

Implementation of complementary filter and output of sensor while stationary

The code for a complementary filtered angle is not outputting the expected angle. I can get close to 90° using arctan formula from the accelerometer sensor data. Whereas, the complementary filter ...
ckkkk's user avatar
  • 9
0 votes
0 answers
71 views

Serial communication between raspberry and laptop not giving right values

I want to communicate between a Raspberry Pi 3 model B and a laptop using a USB to RS-232 cable and this RS-232 to 3.3V TTL converter via the serial module in Python: GND is connected to board pin #6 ...
Nightmerker's user avatar
0 votes
0 answers
133 views

Converting the output of a Proportional Control System to a meaningful drive of a Peltier

Trying to create a PID controller for temperature control using a Peltier element, I decided to take it step by step and create first the Proportional and then the Integral and the Derivative ...
J. Doe's user avatar
  • 121
0 votes
0 answers
96 views

Checking for signals above strength threshold over SDR on VHF

So I have a small NooElec Software Defined Radio and I've got it working well with my Raspberry Pi using GQRX as a controller and to visualize the SDR output. My goal though is to use a python script ...
clifgray's user avatar
  • 213
0 votes
0 answers
38 views

Calculating cell resistance in dependence from cell temperature from CAN bus logs

I'm part of a formula student team. When we go testing we are logging the CAN bus data the car produces to further understand what the car is doing. We log all the battery cell temperatures/voltages ...
JulianWgs's user avatar
  • 101
0 votes
0 answers
1k views

Most accurate, available way to control a stepper motor with python

I am doing a project where I am controlling a nema 17 stepper motor with a raspberry pi 3b. The raspberry pi is controlling the motor through a pyqt5 gui (python 3 is the language). I am using tb6600 ...
Fillups's user avatar
  • 23
0 votes
0 answers
531 views

Internet access to LoPy (ESP32) using its GPIO pins

LoPy is a LoRa module which uses ESP32 chipset. It has WiFi and Bluetooth connectivity for Internet. In my setup, I have certain interference issues, so I can't use WiFi nor Bluetooth to connect my ...
shivams's user avatar
  • 186
0 votes
0 answers
76 views

Embedding python interpreter in the TM4c1294XL

I have a python file that I want to run on the board. Hence I want to embed the python interpreter (written in C) in the board. I managed to write separate C project that runs the Python file. It ...
Meet Taraviya's user avatar
0 votes
1 answer
112 views

Wired ESP8266 Communication

I have been looking for the cheapest/easiest way to get 100 or so different i/o devices to all talk to a "Master." (Sending temp data, receiving motor information) Since i am looking for a ...
drew wood's user avatar
  • 231
-1 votes
1 answer
121 views

Stepper motor position control

i currently try to control a stepper motor to position a camera, to keep my face in the middle of the frame. The face detection is working, and my python program(on raspberry pi 3) can determin the ...
Moritz's user avatar
  • 1