Go to advanced search

by njh
Tue Nov 10, 2020 1:31 pm
Forum: Beginners
Topic: How would I start
Replies: 4
Views: 273

Re: How would I start

In essence it's the same -- you can either bit-bang some GPIOs or use the dedicated SPI port to write bytes into the shift registers (maybe using a CS pin or a separate GPIO to control the latches). Do bear in mind the Pi's I/Os are all 3.3V. If outputting to 5V logic consider 74HCT; for inputs you'...
by njh
Wed Oct 21, 2020 11:40 am
Forum: Other programming languages
Topic: ARM Assembly, using 'printf' to print multiple variables in a loop
Replies: 1
Views: 1145

Re: ARM Assembly, using 'printf' to print multiple variables in a loop

Your loop seems to be empty, so it's hard to see what you were trying to do. But it sounds like you have the right idea. Calling printf() or any function will trash registers r1-r3 so you can't use those as loop state. If you wanted to return from main() you'd need to use the stack and follow the C ...
by njh
Tue Sep 08, 2020 12:33 pm
Forum: Graphics, sound and multimedia
Topic: need help with First Project
Replies: 3
Views: 259

Re: First Project

The LEDs are easily doable. If you have blue or white LEDs, or lots of LEDs at high current, you will need a transistor circuit to drive them. A few red, yellow or green LEDs can be driven directly just with resistors. Or consider using smart RGB LEDs (NeoPixels) perhaps, though they are not so smal...
by njh
Wed Aug 26, 2020 11:46 am
Forum: Beginners
Topic: Which GPIO pins are SAFE to use?
Replies: 3
Views: 205

Re: Which GPIO pins are SAFE to use?

Most pins have special functions but if you don't need those functions, most of them are safe to use. Some exceptions: Physical pins 27, 28 (GPIO0, 1) are an internal I2C bus and should not be used The other I2C on pins 3, 5 (GPIO 2, 3) can be used generally, but be aware they have permanent pull-up...
by njh
Mon Aug 03, 2020 9:06 am
Forum: Beginners
Topic: Output pin and internal pull resistors
Replies: 2
Views: 183

Re: Output pin and internal pull resistors

This is not the expected behaviour. Driving a GPIO pin OUT and LOW should drive it to 0V, regardless of pull-up. Is it possible that either the Pi is damaged, or software is incorrectly setting the pin to input instead of driving it low? Try a different GPIO, or a different Pi. Try flipping the LED ...
by njh
Sat Jul 25, 2020 1:21 pm
Forum: Graphics, sound and multimedia
Topic: Sound input to equivalent tone square wave!
Replies: 5
Views: 464

Re: Sound input to equivalent tone square wave!

Ah, I should't have mentioned a battery -- the OP didn't -- I guess they could use a 9V mains supply and a 5V regulator. It still doesn't sound like a project for which you could just use a Pi Zero without a lot of external components (and If the kind of square-wave regeneration I suggested isn't wh...
by njh
Fri Jul 24, 2020 10:04 am
Forum: Graphics, sound and multimedia
Topic: Sound input to equivalent tone square wave!
Replies: 5
Views: 464

Re: Sound input to equivalent tone square wave!

You can not power the Pi from 9V using resistors . You need a regulator. A 78S05 should do the trick -- remember the capacitors. A SMPS module would be more efficient. But a PP3 type battery might not supply enough current. So this project might not be a good fit for a Pi, even a Zero. If you have ...
by njh
Fri Jul 17, 2020 3:06 pm
Forum: Beginners
Topic: video output with VGA-C connector
Replies: 20
Views: 663

Re: video output with VGA-C connector

It sounds like the OP may be using a HDMI-to-VGA converter rather than just a DVI cable?
What kind of adaptor is it exactly?
Some of them can be fussy about video modes (try changing the screen resolution in "preferences") or power supplies.
by njh
Sat Jul 04, 2020 10:55 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Using Optoisolators at 115200 baudrate
Replies: 4
Views: 662

Re: Using Optoisolators at 115200 baudrate

Just some random extra suggestions for debugging Just with a mutlimeter you should be able to measure high and low state voltages (with some bodge to make the output stick low). If you can transmit repeated byte values like 0xF0 or 0x55 you should get a middling DC voltage and it should be about the...
by njh
Wed Jun 24, 2020 11:29 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 3.3v RPi GPIO to 5v MOFSET SIG pin level shift
Replies: 7
Views: 753

Re: 3.3v RPi GPIO to 5v MOFSET SIG pin level shift

That one looks to have the same problem -- VGS(th) too high to drive reliably from 3.3v.
IRF3708 would be a better choice.
by njh
Tue Jun 23, 2020 10:34 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 3.3v RPi GPIO to 5v MOFSET SIG pin level shift
Replies: 7
Views: 753

Re: 3.3v RPi GPIO to 5v MOFSET SIG pin level shift

Oh. When I wrote that I assumed there would be unidirectional level shifting modules based on 74HCT125, but they seem hard to find. You may have to buy a bare chip 74HCT125 to do level conversion. The Arduino nano as a driver would be overkill of course, but if you have one to hand it should do the ...
by njh
Tue Jun 23, 2020 12:31 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 3.3v RPi GPIO to 5v MOFSET SIG pin level shift
Replies: 7
Views: 753

Re: 3.3v RPi GPIO to 5v MOFSET SIG pin level shift

It's hard to tell from the photos what exactly the circuit is. But I suspect the problem is a subtle incompatibility between the modules. Firstly, the IRF520 requires a threshold voltage of 2V-4V to turn on, and requires even more voltage if it's controlling a large current. So you are correct to us...
by njh
Tue Jun 23, 2020 10:07 am
Forum: Troubleshooting
Topic: WINE on Raspberry pi 3B +
Replies: 4
Views: 614

Re: WINE on Raspberry pi 3B +

Hi Sanderei, I would be interested to know how you got on with LMMS, if you could share your experiences. Did you ever get the VST to work with WINE? I recently tried LMMS on a Pi4 (not in WINE) and found the GUI was quite laggy when playing music, there were occasional audio dropouts, and some of t...
by njh
Sat Mar 28, 2020 1:28 pm
Forum: Troubleshooting
Topic: Calculating resistors smd leds and GPIO button input. Minimum or maximum voltage / current
Replies: 15
Views: 962

Re: Calculating resistors smd leds and GPIO button input. Minimum or maximum voltage / current

LED forward voltage varies with current, and also from device to device. When it's close to 3.3V then it's difficult to regulate the current with just a resistor, so use the 5V supply with a transistor as Bob shows. The current you want for the calculation is the smallest of what the circuit can sou...
by njh
Mon Mar 23, 2020 12:36 pm
Forum: Troubleshooting
Topic: Strange WS2801 LED stripe behaviour
Replies: 8
Views: 906

Re: Strange WS2801 LED stripe behaviour

Hi. If you want to try it without a buffer/levelshifter (it might work) try this: https://tutorials-raspberrypi.de/wp-content/uploads/2016/10/Raspberry-Pi-WS2801B-RGB-LED-Stripe-Schaltplatine.png Note the way both GNDs connect together (just connect both black wires to the same terminal on the LED s...
by njh
Tue Mar 17, 2020 10:19 am
Forum: Troubleshooting
Topic: Strange WS2801 LED stripe behaviour
Replies: 8
Views: 906

Re: Strange WS2801 LED stripe behaviour

Yes, all GNDs should connect to a common point. But try not to make loops. If you use the 74AHCT125, pin 14 should be connected to the LED power supply, so it produces the correct voltages for the LEDs. If you have separate power supplies, don't connect anything to the Pi's 5V header pins. You'll ne...
by njh
Tue Mar 17, 2020 9:25 am
Forum: Troubleshooting
Topic: Strange WS2801 LED stripe behaviour
Replies: 8
Views: 906

Re: Strange WS2801 LED stripe behaviour

Unfortunately the only clear example I can find on the web is for WS2812B, which is not quite the same . But to adapt it for WS2801, the pinout for the 74AHCT125 would be 1 - GND 2 - SCLK 3 - CI (to LEDs) 4 - GND 5 - MOSI 6 - DI (to LEDs) 7 - GND (common) 14 - 5V (LED supply) basically using pins 4,...
by njh
Mon Mar 16, 2020 1:10 pm
Forum: Troubleshooting
Topic: Strange WS2801 LED stripe behaviour
Replies: 8
Views: 906

Re: Strange WS2801 LED stripe behaviour

Perhaps it is a voltage level problem? The Pi GPIOs work at 3.3V which is slightly out of spec for WS2801 inputs. If so you might need a 2-channel level shifter or buffer (for instance use a 74AHCT125. If you roll your own circuit, it should be non-inverting; Make sure it won't source any current ba...
by njh
Mon Mar 16, 2020 12:30 pm
Forum: Beginners
Topic: bss138 with LED strip python
Replies: 1
Views: 293

Re: bss138 with LED strip python

I'm guessing you have a discrete bidirectional level shifter made using BSS138 transistors, and perhaps a WS2812B based LED strip? If so: On the Low Voltage (LV or VDD1) side, connect the Pi to the level shifter: GND to GND, 3.3V to LV, and GPIO18 (say) to one of the level shifter's data pins (you o...
by njh
Fri Mar 13, 2020 9:50 am
Forum: C/C++
Topic: Toggle 1st gpio on every Nth 2nd gpio falling edge, more elegant pigpio solution?
Replies: 18
Views: 1212

Re: Toggle 1st gpio on every Nth 2nd gpio falling edge, more elegant pigpio solution?

FWIW, I thought your first version was clearer. There's little point worrying about the relative costs of "if" and "%"; or of "1-" versus "1^" in this case. The bigger inefficiency is the busy-polling loops -- instead of which, why not use a callback? Somethin...
by njh
Wed Mar 04, 2020 3:04 pm
Forum: Beginners
Topic: No. of GPIO pins required for my project
Replies: 3
Views: 344

Re: No. of GPIO pins required for my project

1. It's looking tight! There are 26 usable GPIOs (some pins have special functions like PWM or I2C, but those can be emulated in software on any pin at slightly lower speed), which is exactly(?) the number you need, with none to spare. I'd suggest using an expander to drive the "direction"...
by njh
Wed Mar 04, 2020 11:36 am
Forum: Networking and servers
Topic: How to write JSON data on HTTP with Python?
Replies: 7
Views: 1370

Re: How to write JSON data on HTTP with Python?

What happens if you try on the server

Code: Select all

    var latest_temperature = req.body.temperature;
    var latest_humidity = req.body.humidity;
by njh
Tue Mar 03, 2020 12:16 pm
Forum: Networking and servers
Topic: How to write JSON data on HTTP with Python?
Replies: 7
Views: 1370

Re: How to write JSON data on HTTP with Python?

Your example code seems to be incomplete: You didn't show the part where you make the request. Also can you explain why there are two different IP numbers mentioned in your message? Which one are you connecting to? But if you're getting a 404 response, it probably does mean the URL is wrong. Maybe t...
by njh
Mon Mar 02, 2020 12:08 pm
Forum: Beginners
Topic: Current flow in bi-directional level shifter?
Replies: 4
Views: 593

Re: Current flow in bi-directional level shifter?

Thanks for your answer. Can I know why your solution only works if the shifter is not used bi-directionally? Is it because the series resistor will drop the signal voltage on the Uno end, so only the Pi can understand the Uno but not the other way around? In that case does it help to place the resi...
by njh
Fri Feb 28, 2020 11:07 am
Forum: Beginners
Topic: Current flow in bi-directional level shifter?
Replies: 4
Views: 593

Re: Current flow in bi-directional level shifter?

The MOSFET in the level shifter includes a built-in diode which will conduct whenever the Pi side (normally 3.3V) of either signal is more positive than the Arduino side (normally 5V). So a current can flow into the Arduino's I/O pins, and then through its protection circuitry to its power supply wh...

Go to advanced search