A list of puns related to "Gpio"
I have written "mqtt-gpio" which connects MQTT topics to Raspberry Pi GPIO pins. It supports input and output pins; groups of pins; and complex inching. Configurable with YAML.
I run it in K3s on Raspberry Pi OS. The service is built on gpiozero so should work on other devices. It is a very helpful building block in my DIY home automation system. It's a general purpose connector so it can be configured for many different uses. At present I use it to:
Prebuilt container images on Docker Hub. Docs on GitHub: README.md.
I hope that "mqtt-gpio" can help others have more capability and fun with RaspberryPis.
Hey everyone,
I am having a problems mounting a WittyPi 3 board to a RPi 4 in such a way, that it fits where I need it to fit and also clear the active CPU cooler I have installed.
https://preview.redd.it/vpvygpnismc81.png?width=2488&format=png&auto=webp&s=b9b03ba4a819a798d0cb11a3e26629229a0a8789
I originally wanted to use a vertical header extention, such as this. I can't do that because of vertical space limitation where I want to use this setup in (cant do anything about that one). However I do have a lot more horizontal space and can mount the board sideways (any orientation, as long as all the ports are unobstructed), the only problem I have is I can't find a suitable extension and GPIO extension cables proved to be too clunky and hard to bend where I needed them to bend.
Greetings. I have an Espressf ESP32-DEVKITC-VE module running with a 240 MHz system clock on the Arduino IDE with the latest ESP32 Arduino CORE. I decided to take a look at how fast I can toggle an ESP32 GPIO pin. I used the code shown below. Much to my surprise the result was just 4.0 MHz out - on an ESP32 with a 240 MHz system clock! There are no other tasks running on the ESP32, no WiFi, no Bluetooth... nothing.
Question: Why is the ESP32 GPIO toggle so slow? Does it have something to do with FreeRTOS? If yes, can anyone point me to a complete explanation? Yes, I did search the Web for an answer before posting here, but I did not find anything satisfying.
/*
File: GPIO_Speed_v1_00.txt
Status: Outputs a 4.000 MHz 50.0% duty cycle square wave.
*/
void setup() {
Serial.begin(115200);
Serial.println("GPIO_Speed_v1_00.txt");
pinMode(GPIO_NUM_26, OUTPUT);
while(1) {
GPIO.out_w1ts |= (1 << GPIO_NUM_26);
GPIO.out_w1tc |= (1 << GPIO_NUM_26);
}
}
void loop() {
//do nothing
}
Here is what the GPIO output looks like on an oscilloscope:
Thank you , David
Can someone please provide an explanation on how the GPIO ports on the ROM chip work within the game cartridges for RTC, Rumble, and Solar sensor?
I've read through GBATEK and it's very cryptic, I don't' understand it.
I'm talking from a hardware perspective.
The RTC chip is a 3 wire serial interface. The datasheet for the RTC chip is online. The datasheet for the chip that stores the ROM is not.
I don't understand how the ROM chip has GPIO ports, and how it generates it's own 3 wire serial signals to read data from the RTC chip. I typically think of a ROM chip as just a data storage that can only be written to. But apparently the one on the game cartridges has it's own GPIO ports and can even generate 3 wire serial signals? This sounds like a microcontroller and not a ROM chip.
Moreover, once it reads the data from the RTC chip, it writes it into the ROM? GBA TEK says that it is zeroed out, the address where it stores data from the GPIO. But how can this be if the RTC chip is connected only to the ROM chip directly? All I can think is that it's writing data to the ROM chip?
Thanks for any help in understanding it. I know there's a lot of details about the software commands and such, but I just don't understand how it works on a hardware level.
New to Raspberry Pi so bear with me. Bought a Canakit Raspberry Pi 4 and the fan seems to run nonstop even though Iβve got the temperature set at 80 and itβs only running in the low to mid 50βs. Does selecting disable in the settings turn it off? Is there another way? Not even sure I need the fan running since itβs not hot but donβt want to remove or really even disconnect the fan. Itβs connected to 5v pin 4 and grounded on 6.
https://i.imgur.com/N58Drif.png
So I was wondering about the super in depth details. I understand that gpio pins use transistors/logic gates to go high and low. What I can't wrap my head around is where the current for the transistor gates is coming from. In order to turn the transistors on and off the gate would have to be going high and low. How is that possible without physically disconnecting the circuit from the power supply? Wouldn't there have to be a physical switch or something? How is this possible without human interaction?
I'm interested in learning Python and one early use case I have in mind is controlling and acquiring data from external hardware devices (sensors, motors, lights, etc). It is mainly for hobby stuff so am interested in doing it in a low-cost way and don't need high spec devices.
I want to have the ability for interactive control from a computer, so am looking at Python rather than micropython/circuitpython. I'm aware of Raspberry Pi as an option for this but I wonder if anyone can recommend any low-cost USB DAQ / GPIO devices I could use with Python on my laptop instead?
By low-cost I mean anything around or under $100.
Ideally I want something with at least 1 true DAC channel (which I know is not often available on very low cost DAQs). But am also interested in options without DAC channels.
I wonder if there are any really cheap options (like less than $50)???
Hello guys, I bought my first raspberry pi zero couple of days ago and I wanted to make myself a crypto storage wallet. I wanted to use a adafruit 128x64 oled but currently no one is selling those in my country. So I went with a more compact display and extra buttons, but I needed less pins for that. Then I decided to desolder my gpio pins to do this. After watching couple of videos and reading some articles, I firstly tried to take plastic parts off, but the plastic parts did not come off. so I heated the pins and sucked the liquified metal with my solder sucker but I ended up butchering the pins. what can I do right now ? thank you.
https://preview.redd.it/9t613g456nz71.png?width=4032&format=png&auto=webp&s=bc31d6e4ba4ccd5dffef962bea0cc2d08f888fd3
https://preview.redd.it/al1upg456nz71.png?width=4032&format=png&auto=webp&s=1bd6e7b2756a03267235f6e29ed721fe91ba9cc8
https://preview.redd.it/bi1njz456nz71.png?width=4032&format=png&auto=webp&s=0af6a123a0c930010b32c56b11feb5baf2190c97
https://preview.redd.it/zrso9z456nz71.png?width=4032&format=png&auto=webp&s=129e27db6129e7dc8fd5a0b3404021fa2c480772
Did you folks know the ESP32 lays pins out in two banks? The first 32 pins are in the first bank, and the rest are in the second bank.
You can turn multiple pins off and on very quickly all at once using a uint32_t flag, one bit for each pin - set/cleared or not set/cleared (see code)
Even for a single pin this method is much faster than digitalWrite under arduino.
Sometimes it's even too fast if you're using it to control, say a CS line on an SPI device, but you can work around that easily.
Here's code and notes:
I am using the Octorelay plugin on my Pi4b and its working great. I only have 2 relays connected one to power my Ender3, and the other to power an LED light bar. All I want to do is to slowly blink the LEDs when a print is done. and quickly blink it if the print fails. and id like it to keep blinking for a set amount of time or # of cycles.
I assumed this was a no brainer but I can't figure out how to do this.
Hey,
Setting up adxl345 for the first time and since I'm using a gpio screen, one or two of the suggested pins are already in use. I cannot for the life of me figure out where the used pins are declared/specified? So that I can change the ones I need to other unused pins instead.I hope this makes sense.
I don't really understand this part:
[adxl345]
cs_pin: rpi:None
Big thanks for any assistance!π
Trying to create a WIFI connected 4x4x4 led cube. I am having trouble setting most of the pins to HIGH. I have tried various iterations of code in PlatformIO and the Arduino IDE. Its my understanding that most of the pins should be able to be set to HIGH by just referencing the GPIO pin by its corresponding int. Is there an extra step I need to do to enable these pins? I am using the "ESP32-WROOM-32D", I have selected the board as the NodeMCU-32S. I attached a screenshot of one of the version of code I have been using to troubleshoot. Any advice would be appreciated
disclosure: I'm working on the simpsons tv project
I'm a little confused about how to enable audio on a rpi zero. I understand that pwm is needed to emulate sound and that GPIO 18 and 13 are pwm.
Does this mean that none of the other pins are capable of pwm?
In the simpsons tv guide, he reconfigured GPIO 18 with
raspi-gpio set 18 op dl
raspi-gpio set 19 op a5
raspi-gpio set 8 a2
raspi-gpio set 7 a2
Can someone explain what that code is doing? I'm confused how pins can be reconfigured. How can GPIO 19 suddenly be able to output pwm?
Fair warning: my electronics knowledge is weak.
Issue: I have the data pin of the DHT11 connected to PD9 which is configured as an output open drain with pull-up enabled. I thought this was correct because my DHT11 module contains a 10k pull-up between the data pin and VCC (+5V). But, the line signal stays LOW even when i try to toggle the pin HIGH. Why is this? I have a cheap logic analyzer (24 MHz) hooked up to this signal so I'm able to see that its LOW.
I measure the GPIO pin without the sensor connected and it behaves as expected (if you set pin state HIGH, signal is HIGH and vice versa for LOW state).
I changed the configuration to push-pull with no pullups/pulldowns enabled and I am able to control the pin state via my code. However, I'm not sure if this is correct.
Any feedback is highly appreciated. Thank you.
Hi experts,
I'm using a Tiva launchpad (TM4C123G) and has the following code:
#define GPIO_PORTA_DATA_R (*((volatile unsigned long *)0x400043FC))
void SwitchPA5Init(void) {
// Map PA5 to switch
int delay;
SYSCTL_RCGC2_R |= 0x00000001;
delay = SYSCTL_RCGC2_R;
GPIO_PORTA_LOCK_R = 0x4C4F434B; // Unlock PortA
GPIO_PORTA_AMSEL_R &= ~0x20; // Disable analog on PA5
GPIO_PORTA_PCTL_R &= ~0x00F00000; // PCTL GPIO on PA5
GPIO_PORTA_DIR_R &= ~0x20; // Set input for PA5
GPIO_PORTA_AFSEL_R &= ~0x20; // PA5 regular port function
GPIO_PORTA_DEN_R |= 0x20; // Enable PA5
}
unsigned long GetSwitchStatus(void) {
volatile unsigned long rtl;
rtl = GPIO_PORTA_DATA_R & 0x20;
return (rtl);
}
int main(void){
TExaS_Init(SW_PIN_PE0, LED_PIN_PE1, ScopeOn);
SwitchPA5Init();
while(1){
if (GetSwitchStatus() == 0x20) {
// Do something;
}
}
}
I believe that GPIO_PARTA_DATA_R should has its 6th bit (PA0 is 1st bit, and so on) set as 0 (0x??0?????), and GetSwitchStatus()
should always return 0x00 IF there is no input of PA5 from the breadboard. However, I was astonished to find that sometimes it returns 0x20 (i.e. PA5 is set). After walking through the assembly code, I found out that GPIO_PORTA_DATA_R switches between 0x03 and 0x23 for every while(1) loop. I understand 0x03 because PA0 and PA1 are used internally, but why is PA5 flipped?
Here is the breadboard. Red line connects to V3.3 and orange line connects to PA5. But there is no input to PA5 as I removed the switch that connects the two short yellow lines.
https://imgur.com/o3ReEwH
Hello,
I am looking for TVS diodes that can be used to protect the raspberry pi from ESD.
While looking for it I have faced a few issues.
Firstly I could not locate the maximum tourable voltage for the GPIO pins. In general, MCUs or Processors have a certain tolerance level, it's not exactly 3.3V. Normally it's something like 3.3V to 3.7V. And above that voltage, the pin might get damaged. But for Raspberry pin wherever I look for it, it always says that "do not exceed 3.3V". Does that mean Pi can tolerate absolute max of 3.3V on its GPIOs And above that voltage level, it will damage the PI?
In that case, the clamping voltage of the TVS diode should be 3.3V (please correct me if I'm wrong) but I could not find any TVS diode with that low clamping voltage.
I am curious, to know what TVS diodes do people normally use to protect PI's GPIOs and I am not married to the concept of using TVS diode if there is any other way to protect the GOPI's of Pi from ESD, I would also like to educate myself with that concept.
Thanks.
Hello! I'm new to this whole raspberry pi thing and I would like some help!
I recently bought a rpi zero w 2 so I could make a portable retro gaming machine using retropie.
I bought this 4" display that uses the gpio for signal https://www.waveshare.com/wiki/4inch_DPI_LCD_(B). I modded an old power bank, added a switch so I can power it on and off and 3d printed a (prototype) enclosure for them. I also bought a cheap ipega bluetooth controller, the sort that you normally put your phone in between the left and right sides and (after a lot of googling) managed to make it work.
So far it works perfectly, but a few days ago I thought I'd connect it to my TV and use the controller separate so I can play from my couch.
Problem is that as far as I keep the gpio monitor connected, the hdmi output stays blank (wakes the TV or monitor up but outputs nothing).
I tried uncommenting the force_hdmi line in config.txt but it didn't work.
Any help is appreciated! Cheers!
The labels seem to show the left one is 5V and the right one is Ground. Are the middle two GPIO that can be plugged into any GPIO on RP?
https://preview.redd.it/a07g53l52s981.png?width=962&format=png&auto=webp&s=9474c07bc1e77fa958460215aab0fabede34a1c3
[SOLVED]
I'm trying to make a button box to test another project that I'm working on, and I have several PCF8574 breakout modules. But then I go looking for libraries to control them, and there are about half a dozen.
The first one I tried was "IOabstraction," but it seems to be a bit overkill -- very powerful, but with features I don't need, and the examples use stuff like the task scheduler library that I don't know how to use yet, so it's made learning to use it like pulling teeth. Then I tried one just called "PCF8574," but the button example for that one is difficult in the other direction; I'm not exactly sure how the given byte value tells you which pin is being operated on, and it really doesn't explain what it's doing. "EasyPCF8574" throws an error message 1 ('Error compiling for Arduino Uno) when I try to upload the example (EDIT: Oops, that's for ESP boards).
Gahh! I'm about to go back to a good old-fashioned shift register here, but I'd prefer to learn to use PCF expanders, as they seem way more functional (plus I'd prefer not to have 10 wires coming out of my button box!) Can anyone tell me which library is best for a newbie without a ton of experience who doesn't need a ton of fancy features, but which has decent documentation?
Edit: It has been pointed out that you only need to built-n Wire.h library to control these devices, and that for something simple like reading buttons, it's best to roll my own rather than futzing with libraries.
In case anyone needs an example, here's a button test I came up with using the example code that /u/crispy_chipsies kindly provided:
#include <Wire.h>;
const int expander = 0x20; //i2c address, see notes
byte pins = 0xFF;
void setup() {
Serial.begin(9600);
Wire.begin(); // join i2c bus (address optional for master)
}
void loop() {
Serial.println(buttonRead(7)); //Where 7 is the largest bit in the byte, pin 8.
}
int buttonRead(int bitIndex) {
int result;
Wire.requestFrom(expander,1);
for (uint32_t tm=millis(); millis()-tm < 1000UL; )
if (Wire.available() > 0) { pins = Wire.read(); break; }
result = bitRead(pins, bitIndex);
return result;
}
In this case, it simply reads the bit value of the PCF's byte. The button is wired between the number 8 pin on the PCF and ground. No pull-up resisters or anything seem to be necessary. Button presses reads as zero, otherwise it reads as 1.
I determined th
... keep reading on reddit β‘Hello,
I'm trying to program a simple pushbutton with interrupt on pico using the C SDK, but the the internal pull up enable function static void gpio_pull_up (uint gpio)
does not seem to work when used with gpio_set_irq_enabled_with_callback(button_pin, GPIO_IRQ_EDGE_FALL, true, &gpio_callback_function).
Without enabling the pull my interrupt function is being called when the gpio pin is pulled low.
Has anyone else seen the same issue or could provide an explanation on why ?
I found an old PCI card based on the Brooktree BT848 chip, which has on it 24 GPIO pins accessible by the Linux kernel.
However, these GPIO pins are not isolated or protected. And given they will be interacting directly with the PCI bus, I will need a way to protect them.
So what is the best way to protect a GPIO pin? Line drivers, optocouplers, and so on, are all options. However, I want to be able to preserve the ability to use each pin as an input or an output.
I would like to protect against overcurrent/short-circuit, overvoltage (transient or constant), etc. The usual.
I highly doubt there is a turnkey solution with 24 channels, but if someone has an IC they know of (a type or specific one) which could do the job, that would be great. The simpler the better, obviously.
Working with 0-5V, and I'd like to be able to sink between 250-500 mA safely, with anything more being limited/protected.
Has anyone successfully used a MCP23017 I2C GPIO Expander on a Raspbery Pi to build a controller for RetroPie?
Ok so this might a basic question, in that case i'm sorry.
There's a pin from a breakout board (a reset pin) that is active-low, constantly pulled up to high at around 3 volt, and to reset the module, you gotta pull it down for a few millsecs to near <0.6 volt.
The most obvious method i use is ofc using a npn transistor, one end connected to ground, one to the reset pin, and the base to the MCU GPIO (resistors included).
But according to the module's datasheet it said it's possible to "directly" drive this pin using GPIO since it has internal isolation already (https://ibb.co/p0dxq9R)
So can i just slap a jumper from the reset pin to my GPIO and digialWrite low to drop its voltage?? I'm kinda unsure
Thanks for the answers!
P.S. It's SIM800L Module btw
I'm trying to write a library for handling push button debouncing and long press/short press events.
Having looked at Arduino libraries that do the same using millis function often called from ISR.
In the case of pico, can the get_absolute_time function be called from the GPIO interrupt routine ? How is the overflow handled for this function ?
I can find thousands of google hits describing the alternate functions of GPIO pins (UART, I2C, etc), I can't find word one telling me when those pins are used to perform their alternate functions. Are there libraries or kernel modules that enable them? If I don't want the alternate function can I simply use any GPIO pin for "ordinary" GPIO without worrying about the alternate function? This seems like a question that should have an obvious answer, but google has not been my friend today.
I have a 3.5" inch GPIO touch display for my Pi Zero. When I connect and install it, this will give the user access to the desktop and console. I don't want that for security reasons.
I only want to use this display to show specific content (ex hardware stats, or an app), without the user being able to gain control over the entire Pi.
Is this somehow possible?
Does anybody use a motion sensor with the ESP CAM MB (link below)
Wondering if there's a spare GPIO I could use. https://www.amazon.co.uk/dp/B08P1NMPLL/ref=cm_sw_r_apan_glt_i_B3588YMG370CZVDV3CYN?_encoding=UTF8&psc=1
Hi everyone,
Iβm looking for advice how to set up automated testing of some kind. I have a few PWM and several GPIO (Outputs to start with) I would like to get under test coverage. I do t have external hardware like National Instruments, dSpace, or Raspberry Pi fixtures as the product Iβm on doesnβt have time/budget to build a test fixture. So Iβm hoping I can get some ideas from a software/firmware side.
I have access to shell where I can print messages, an RTOS with a few dozen tasks, and Ethernet only communication.
In the most simple state I would like to use my existing commands to set and read states. A simple setGPIO(U32 pin, U8 state) and getGPIO(U32 pin) are the equivalent of what I mean. I could park the main application and stimulate these pins one at a time checking their state as my test. This solution doesnβt require implementing any additional code in my project. But the downside is I canβt detect that a sequence of lights that mean something. Only if the firmware has hit the right GPIO. So no timing or sequencing is available here.
I was thinking that I could define a βtest logβ task that compiles input from the system. Messages are time stamped on entry into a queue when the GPIO had an event (on/off). Then once the sequence is complete I simply fetch the messages in the queue to determine if the right timing and sequence occurred. This means I could invoke inputs to fire off GPIO outputs, stuff a message in the order the Outputs execute, consume the report on the automation side, and dictate that the correct result happened. Unfortunately this means I have a few places I have to add non-production code to the project and build as a debug build before I can test my work. Itβs not something thatβs been done before around here and I donβt want to set us out on a bad path of maintaining code thatβs not for production in the master branch.
Lastly, the IDE does have a System Profiler feature but itβs very tedious and used only twice in the past 5-10 years. Itβs pretty esoteric and Iβm not sure Iβm even able to save a log or record a log for parsing in my automation. But it would ensure that I donβt add non-production code while still capturing sequences/timing.
Can anyone give examples of how to capture HW events and test the correct operations occurred?
Trying to add a power button..plugged this button into GPIO pins 3 & 4. Applied the script found here ...I plugged the power button into the wrong GPIO pins (I know)...pressed the power button and it turned off..now nothing. Red power light but no activity lights. Tried flashing the micro SSD card...no change.
For what its worth I'm running a Pi 3B+
I'm having trouble finding good resources showing me how to make circuits. I'm following this tutorial and don't understand how to modify it when I want to use different parts. https://kylegabriel.com/projects/2020/06/automated-hydroponic-system-build.html#Connecting_the_Sensors_LCD_and_Pump
What are some good ways to learn how these circuits are constructed?
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.