Go to advanced search

by jayben
Fri Sep 18, 2020 4:39 pm
Forum: Python
Topic: SPI Challenged
Replies: 2
Views: 103

Re: SPI Challenged

The clock won't be continuous; it will only be active during a transfer.

My post https://iosoft.blog/fast-data-capture-raspberry-pi/ has Python and C code to drive the SPI interface, with an example oscilloscope waveform.

Your SPI clock frequency of 4 kHz is really low, it might cause problems.
by jayben
Tue Sep 15, 2020 7:51 am
Forum: Advanced users
Topic: Real Time Audio Processor With Raspberry Pi and ADCDAC Pi Zero
Replies: 1
Views: 86

Re: Real Time Audio Processor With Raspberry Pi and ADCDAC Pi Zero

I think you'll struggle to get anything working without some complex coding. The erratic data input and output can be fixed by using DMA; my code for the MCP3008 could be modified for the purpose, see https://iosoft.blog/fast-data-capture-raspberry-pi/ This allows you to get accurately-timed samples...
by jayben
Mon Sep 14, 2020 9:37 am
Forum: Python
Topic: MPU6050 internal clock
Replies: 7
Views: 183

Re: MPU6050 internal clock

As scotty101 says, you can look for the overflow condition, but personally I'd read the FIFO_COUNT registers 114 and 115 to get an idea of how close the FIFO is to overflowing. With regard to your question on timing, the answer depends on what you are trying to achieve. If the device is generating s...
by jayben
Sun Sep 13, 2020 1:00 pm
Forum: Python
Topic: MPU6050 internal clock
Replies: 7
Views: 183

Re: MPU6050 internal clock

The datasheet says that the device has a 1024-byte FIFO, so you can use this to accumulate the data samples, and poll the device to fetch the data - you just need to poll sufficiently frequently that there isn't an overflow. Thanks to the FIFO, the timing of the samples will be correct, even if the ...
by jayben
Mon Sep 07, 2020 7:06 pm
Forum: Automation, sensing and robotics
Topic: Automation of a metal pretreatment line
Replies: 6
Views: 295

Re: Automation of a metal pretreatment line

This is the kind of application for which SCADA programs were invented; they present a user-friendly easily-programmable graphical interface, that drives multiple PLCs using Modbus, or a similar protocol. The problem with automating an existing industrial process is that your actions can have a dire...
by jayben
Thu Aug 27, 2020 8:55 am
Forum: Advanced users
Topic: Raspberry PI 4 GPIO lines maximum speed
Replies: 5
Views: 220

Re: Raspberry PI 4 GPIO lines maximum speed

The dominant factor in measuring those signals will be the capacitance of the oscilloscope probe, which is far greater than the capacitance of a typical logic input, so attaching the probe will increase the rise-time, and reduce the amplitude at higher frequencies. But anyway, we are in agreement th...
by jayben
Wed Aug 26, 2020 3:19 pm
Forum: Advanced users
Topic: Raspberry PI 4 GPIO lines maximum speed
Replies: 5
Views: 220

Re: Raspberry PI 4 GPIO lines maximum speed

In my tests, the limit for the Pi Zero was dictated by the maximum DMA throughput, which is around 20 million 32-bit transfers per second; the SMI interface can aggregate 4 bytes into a single transfer, hence my 80 Mbytes/s figure - but this does require the use of good high-speed hardware technique...
by jayben
Wed Aug 26, 2020 8:43 am
Forum: Advanced users
Topic: Raspberry PI 4 GPIO lines maximum speed
Replies: 5
Views: 220

Re: Raspberry PI 4 GPIO lines maximum speed

The fastest continuous rate with an 8-bit ADC on a Pi Zero using SMI is 80 megasamples per second; the short-term burst rate can be higher.

Sadly, the limit for a Pi 4 running the same code is quite a bit lower, see my blog https://iosoft.blog/raspberry-pi-smi/ for details.
by jayben
Sat Aug 22, 2020 2:52 pm
Forum: Python
Topic: Using a GUI to Control Multiple Python Processes
Replies: 11
Views: 351

Re: Using a GUI to Control Multiple Python Processes

I'd ignore method 1 (too complicated) and start with method 2 by experimenting with timer events, see https://stackoverflow.com/questions/3393612/run-certain-code-every-n-seconds Modify the code to set & clear an I/O line, then try running multiple timers, toggling multiple I/O lines. For method 3, ...
by jayben
Sat Aug 22, 2020 12:28 pm
Forum: Automation, sensing and robotics
Topic: Object sizing using Pi
Replies: 4
Views: 262

Re: Object sizing using Pi

In any computer vision application, the lighting is really important, so that raises the question; why not make life easy for yourself, by using highly structured lighting? For example, you could use 2 laser line sources, one vertical and one horizontal, and tune the image processing to that colour ...
by jayben
Sat Aug 22, 2020 12:08 pm
Forum: Automation, sensing and robotics
Topic: Integerating MPU 9250 sensor data with GPS
Replies: 3
Views: 178

Re: Integerating MPU 9250 sensor data with GPS

Look for GPS 'sensor fusion' with 'dead reckoning'.

It'd be nice if there was an open-source solution; commercial offerings have been available for a while, e.g. https://www.u-blox.com/en/product/zed-f9r-module
by jayben
Fri Aug 21, 2020 8:18 am
Forum: Python
Topic: How to communicate Raspberry pi to PLC?
Replies: 2
Views: 153

Re: How to communicate Raspberry pi to PLC?

I haven't used this package, but the error message in your first attempt does seem sensible; the value you've given for parity is being rejected. A quick glance at the documentation shows a default parity value of 'N' , so I'm guessing the code expects the letters O E or N (for odd, even, none) and ...
by jayben
Wed Aug 19, 2020 8:38 am
Forum: Other projects
Topic: Advice / feasibility of borehole inspection idea
Replies: 10
Views: 539

Re: Advice / feasibility of borehole inspection idea

I'm probably flogging a dead horse here, but I'd just point out that receiving an analogue signal at the head-end is trivial; you can use an LCD monitor or USB frame grabber for composite video, and if the signal is RF modulated, an LCD TV or USB TV tuner will do fine. Minimal cost and no need to de...
by jayben
Tue Aug 18, 2020 8:44 am
Forum: Python
Topic: Using a GUI to Control Multiple Python Processes
Replies: 11
Views: 351

Re: Using a GUI to Control Multiple Python Processes

There are (at least) 3 ways you can do this. 1. Run one 'process' (i.e. thread) for each output, and another thread that handles the GUI, and controls the processes. 2. Use timer events to toggle the I/O states, so there is only one GUI thread. 3. Delegate the pulse generation tasks to another progr...
by jayben
Mon Aug 17, 2020 8:52 am
Forum: Other projects
Topic: Advice / feasibility of borehole inspection idea
Replies: 10
Views: 539

Re: Advice / feasibility of borehole inspection idea

I agree with @hippy; much as there is a tendency to convert everything analogue into the digital domain, this does carry quite a high penalty in terms of front end complication & power consumption, so I'd first look at a purely analog solution. It'd be interesting to try a composite video signal ove...
by jayben
Sun Aug 16, 2020 6:08 pm
Forum: Python
Topic: Run a python code at boot on a Pi zero.
Replies: 3
Views: 178

Re: Run a python code at boot on a Pi zero.

A systemd example; my program was called spi_server.py in the directory /home/pi/uwb, and it used networking, so had to be started after the network was running: sudo systemctl edit --force --full spi_server.service # Add the following to spi_server.service.. [Unit] Description=SPI server Wants=netw...
by jayben
Sun Aug 16, 2020 9:29 am
Forum: Automation, sensing and robotics
Topic: Using LM358 Op Amp to step up clock output from gpio
Replies: 13
Views: 625

Re: Using LM358 Op Amp to step up clock output from gpio

Modern power supplies generally have their +ve and -ve outputs 'floating' with respect to earth, i.e. there is no connection between these pins and ground, so you can connect them anywhere you like. If in doubt, use your DMM on the resistance setting to measure between the -ve (or 0V) output, and th...
by jayben
Sat Aug 15, 2020 9:35 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Power, and nothing else, from OTG or fusebox for pi zero
Replies: 3
Views: 191

Re: Power, and nothing else, from OTG or fusebox for pi zero

I'm not aware of any OTG port providing 12V power, can you give a reference for that?

There is a standard for fast USB battery charging at 12 or 20V, but the Pi doesn't support it. You need a 12V to 5V step-down supply.
by jayben
Sat Aug 15, 2020 9:13 am
Forum: Automation, sensing and robotics
Topic: Using LM358 Op Amp to step up clock output from gpio
Replies: 13
Views: 625

Re: Using LM358 Op Amp to step up clock output from gpio

Absolutely right; the grounds of the Pi, the transistor, and the stepping signals must all be tied together. If you can measure any voltage between them, there is something wrong.
by jayben
Thu Aug 13, 2020 9:02 am
Forum: Automation, sensing and robotics
Topic: Using LM358 Op Amp to step up clock output from gpio
Replies: 13
Views: 625

Re: Using LM358 Op Amp to step up clock output from gpio

Here you are: inverter.png When the input is high, the circuit puts around 3 mA into the base; this makes the transistor conduct, so the collector approaches the emitter potential, i.e. it is like a closed switch between emitter and collector. When the input is low, the transistor stops conducting, ...
by jayben
Tue Aug 11, 2020 6:01 pm
Forum: Advanced users
Topic: Extreme High speed pulse counting
Replies: 13
Views: 525

Re: Extreme High speed pulse counting

True; I didn't actually answer the OP's question, but the principle still applies: to get a pulse count, use the SPI input, and count the transitions in the data. Incidentally, with any of these approaches, there will be a problem around zero speed, since a small amount of back-and-forth vibration c...
by jayben
Tue Aug 11, 2020 1:56 pm
Forum: Advanced users
Topic: Extreme High speed pulse counting
Replies: 13
Views: 525

Re: Extreme High speed pulse counting

Use SPI input. Run the interface at 1MHz (or more), connect the SPI data input to your signal, and ignore the clock, data output & chip select. You will get a stream of zeros, followed by a stream of ones, then another stream of zeros, and so on. Count the number of transitions in a given number of ...
by jayben
Tue Aug 11, 2020 10:21 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: DMA SRC_INC not working as (I) expected
Replies: 8
Views: 1123

Re: DMA SRC_INC not working as (I) expected

In my DMA experimentation ( https://iosoft.blog/raspberry-pi-dma-programming/ ) I did occasionally have problems where non-incrementing memory transfers didn't behave as expected, but peripheral transfers always worked OK. I was able to work around the issue, and assumed it was due to bugs in my cod...
by jayben
Tue Aug 11, 2020 9:48 am
Forum: Automation, sensing and robotics
Topic: Relative position
Replies: 3
Views: 228

Re: Relative position

You can determine the distance between 2 or more units using Ultra Wideband, see https://iosoft.blog/real-time-location-ultra-wideband/ Alternatively, with a few cameras, you could do optical triangulation of LED markers or fiducial tags: https://iosoft.blog/position-measurement-low-cost-cameras-ope...
by jayben
Mon Aug 10, 2020 8:35 am
Forum: Automation, sensing and robotics
Topic: Using LM358 Op Amp to step up clock output from gpio
Replies: 13
Views: 625

Re: Using LM358 Op Amp to step up clock output from gpio

An op-amp amplifies the difference between the signals at its '+' and '-' terminals. Furthermore, many op-amps will only amplify signals if they are significantly above ground potential, and below the supply potential (unless it has a 'rail-to-rail' capability). So if you tie the the negative pin to...

Go to advanced search