Your videos are extremely helpful! It would be awesome if you could do a tutorial on connecting a 16x2 LCD display connected via I2C protocol as I my current project is demanding a lot of GPIOs and I'm running out of options. Cheers!
Nice video. I see you don't seem to debounce when using the polling method. The 1 second delay from sleep(1) doesn't seem like it would act as a debouncing method.
In the example, the 1 second sleep time is the debounce. It is an exaggerated time to make it easier to visualize. It is too much debounce time and could miss quick switch presses. Many newer switches have very short debounce times. The datasheets may give the debounce time in microseconds (µs instead of ms). However switches vary greatly (especially salvaged equipment). You just have to experiment and see what works best even if you have a datasheet. Often you can be very conservative if the timing requirements of your program are minimal. I usually only use the polling method when timing is not critical or when I’m experimenting. Otherwise, I prefer an interrupt.
@@rdagger I see. I'm working with a rotary encoder and require shorter debouncing times. I've gone from polling to interrupts and recently discovered possible device tree overlays for the Pi. I've learned a lot from your videos. Thank you.
7 років тому
Thank you and congratulations from Brazil. Cheers!
It depends on the relay. If there is an unused pole on the relay, you could use it to toggle a GPIO pin. Otherwise, you could add an opto-coupler to the relay’s 5V input. This could trigger an isolated GPIO pin and fire an interrupt assuming there is enough extra current to drive the opto. Another approach would be to place a Hall Effect sensor next to the relay that could detect the changing magnetic field. You could also use a photo transistor to detect the illuminated bulb.
Excellent and clear instructions .. thanks. What would be even nicer would be the for you to add a text file of your script for us to inspect at leisure and use in our own projects. Thanks again
You can buy LCD displays with different character maps. Also there are usually a few spaces for custom characters. I'm not sure if the Adafruit Char_LCD library supports other languages. You would have to check with Adafruit. If not you could probably find another library that does support your language or you could modify an existing library.
Videos are very helpful, but could you include a solenoid(or multiple) that are password protected(Along with the lcd an keypad.) If you could it would be greatly appreciated! :)
This interrupt thing is exactly what I am looking for, but I want it to restart the program. I am basically running a traffic light program and I leave the red LED on for 3 seconds, the yellow LED on for 3 seconds and then the green LED on for 6 seconds. I am using this as more of a drag racing light tree and I will be using a infrared sensor to detect if the object left early or what the reaction time was. Then there will be a switch at the end to tell me total run time. I want to be able to "reset" the program to start from the very beginning at any point in the program, in case there is a problem, instead of waiting till the end to start over. How would I program this interrupt to do that?
You have at least 3 states (pending race, racing, race ended) which you can track with a variable. You have 3 interrupts (sensor at starting line, sensor at finish line, switch to reset race). You turn on your interrupts when the program starts. There is no need to modify them afterwards. Instead you check the race state variable in the call back functions to determine what code runs. The reset race interrupt could be a push button switch that changes the race state to pending race.
This tutorial helps me alot with my new Raspberry Pi. Me auto like. Thanks Dude.
Outstanding production and explanation. Thanks for taking the time and posting!
oh nice. ive worked with stupid variables to make that button-pressing work the correct way. this shown in the video is so much nicer to do
Ahhh man! this video would have saved me so much trouble when I was trying to read pulses from a bill acceptor.
Your videos are extremely helpful!
It would be awesome if you could do a tutorial on connecting a 16x2 LCD display connected via I2C protocol as I my current project is demanding a lot of GPIOs and I'm running out of options. Cheers!
+Mario Hinojosa I have a video on connecting 16x2 LCD displays via I2C protocol to the Pi: ua-cam.com/video/i5A5AsDRRwQ/v-deo.html
Great effort and attention to detail. Thanks.
Nice video. I see you don't seem to debounce when using the polling method. The 1 second delay from sleep(1) doesn't seem like it would act as a debouncing method.
In the example, the 1 second sleep time is the debounce. It is an exaggerated time to make it easier to visualize. It is too much debounce time and could miss quick switch presses. Many newer switches have very short debounce times. The datasheets may give the debounce time in microseconds (µs instead of ms). However switches vary greatly (especially salvaged equipment). You just have to experiment and see what works best even if you have a datasheet. Often you can be very conservative if the timing requirements of your program are minimal. I usually only use the polling method when timing is not critical or when I’m experimenting. Otherwise, I prefer an interrupt.
@@rdagger I see. I'm working with a rotary encoder and require shorter debouncing times. I've gone from polling to interrupts and recently discovered possible device tree overlays for the Pi. I've learned a lot from your videos. Thank you.
Thank you and congratulations from Brazil. Cheers!
How can we use interrupts to check the status of a 5v relay with the incandescent bulb?
It depends on the relay. If there is an unused pole on the relay, you could use it to toggle a GPIO pin. Otherwise, you could add an opto-coupler to the relay’s 5V input. This could trigger an isolated GPIO pin and fire an interrupt assuming there is enough extra current to drive the opto. Another approach would be to place a Hall Effect sensor next to the relay that could detect the changing magnetic field. You could also use a photo transistor to detect the illuminated bulb.
Excellent and clear instructions .. thanks. What would be even nicer would be the for you to add a text file of your script for us to inspect at leisure and use in our own projects. Thanks again
That’s a good idea. I’m going to redo my website and post the code. If you need it sooner, just email me.
Cheers :-)
I need to display other language other thank english . can you help me ??
You can buy LCD displays with different character maps. Also there are usually a few spaces for custom characters. I'm not sure if the Adafruit Char_LCD library supports other languages. You would have to check with Adafruit. If not you could probably find another library that does support your language or you could modify an existing library.
#awesome All videos are really helpful. Thanks!
the liquid crystal display display
Videos are very helpful, but could you include a solenoid(or multiple) that are password protected(Along with the lcd an keypad.) If you could it would be greatly appreciated! :)
Finally I understand this
This interrupt thing is exactly what I am looking for, but I want it to restart the program. I am basically running a traffic light program and I leave the red LED on for 3 seconds, the yellow LED on for 3 seconds and then the green LED on for 6 seconds. I am using this as more of a drag racing light tree and I will be using a infrared sensor to detect if the object left early or what the reaction time was. Then there will be a switch at the end to tell me total run time. I want to be able to "reset" the program to start from the very beginning at any point in the program, in case there is a problem, instead of waiting till the end to start over. How would I program this interrupt to do that?
You have at least 3 states (pending race, racing, race ended) which you can track with a variable. You have 3 interrupts (sensor at starting line, sensor at finish line, switch to reset race). You turn on your interrupts when the program starts. There is no need to modify them afterwards. Instead you check the race state variable in the call back functions to determine what code runs. The reset race interrupt could be a push button switch that changes the race state to pending race.
Thank you for the video>>>>>>>
thank you!!!
Enjoying your series. But, your a bit to fast for this old brain!
Thanks, I appreciate constructive feedback.