Difference between revisions of "Tutorial Digital IO"
(11 intermediate revisions by one other user not shown) | |||
Line 11: | Line 11: | ||
== Related Components == | == Related Components == | ||
− | The components are related to the [[LMUBox]]. For more components, see the [[Hardware List]. Many of the pages on actuators and | + | The components are related to the [[LMUBox]]. For more components, see the [[Hardware List]]. Many of the pages on actuators and sensors include additional examples. |
=== Microcontroller === | === Microcontroller === | ||
+ | * [[ESP8266 D1 Mini]] | ||
* [[ESP32 Web Kit]] with integrated OLED Display from Heltec | * [[ESP32 Web Kit]] with integrated OLED Display from Heltec | ||
− | * [[ESP8266 ESP-12F]] NodeMCU Module from AZDelivery | + | * [[ESP8266 ESP-12F]] NodeMCU Module from AZDelivery |
=== Actuators === | === Actuators === | ||
− | * [[LED]]s in different colors to connect externally | + | * [[LED]]s in different colors to connect externally |
− | * [[RGB LED]] multi-color LED | + | * [[RGB LED]] multi-color LED |
− | * [[LED Ring NeoPixel]] | + | * [[LED Ring NeoPixel]] |
− | * [[Piezo Speaker]] | + | * [[Piezo Speaker]] |
− | * [[Speaker]] | + | * [[Speaker]] |
− | * [[SG90 Servo]] Micro Servo Motor | + | * [[SG90 Servo]] Micro Servo Motor |
− | * [[Stepper Motor and ULN2003]] 28BYJ-48 ULN2003 5V Stepper Motor + ULN2003 Driver Board | + | * [[Stepper Motor and ULN2003]] 28BYJ-48 ULN2003 5V Stepper Motor + ULN2003 Driver Board |
* [[IRF520 Module]] Power MOSFET switching module ('electronic relay') | * [[IRF520 Module]] Power MOSFET switching module ('electronic relay') | ||
=== Sensors (and physical controllers) === | === Sensors (and physical controllers) === | ||
− | * [[push button]] | + | * [[push button]] |
− | * [[Switch]] | + | * [[Switch]] |
− | * [[PIR Sensor]] passive infrared motion sensor | + | * [[PIR Sensor]] passive infrared motion sensor |
= Instructional Videos = | = Instructional Videos = | ||
The videos are a first test... the ones marked with ** will be replaced over the next months with new versions. | The videos are a first test... the ones marked with ** will be replaced over the next months with new versions. | ||
+ | |||
+ | If you use the [[ESP8266_D1_Mini]] have a look at this file about which Pins to use: https://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/basics.html | ||
+ | |||
== Digital Output: Adding an external LED to the controller == | == Digital Output: Adding an external LED to the controller == | ||
Line 41: | Line 45: | ||
<youtube>0KGgYsEZcZM</youtube> | <youtube>0KGgYsEZcZM</youtube> | ||
+ | |||
+ | Here is a short video of how to connect and control an LED on the [[ESP8266_D1_Mini]]. | ||
+ | |||
+ | <youtube>GHE5A0WT5AE</youtube> | ||
+ | |||
+ | |||
+ | If you use the [[ESP8266_D1_Mini]] have a look at this file about which Pins to use: https://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/basics.html | ||
== Digital Output: Connectin an external LED (old version using WebREPL **) == | == Digital Output: Connectin an external LED (old version using WebREPL **) == | ||
Line 48: | Line 59: | ||
− | == PWM Output: connecting a servo | + | == PWM Output: connecting a servo and and LED == |
− | In this video on youtube ( | + | In this video on youtube (45:39) we explain the concept of pulse width modulation (PWM) and how to program it in MicrpPython. We show how to use PWM to control a servo and the brightness of an LED: https://youtu.be/XovIHYo7s1A |
+ | |||
+ | <youtube>XovIHYo7s1A</youtube> | ||
+ | |||
+ | |||
+ | == PWM Output: connecting a servo (old version using WebREPL **, 14:40) == | ||
<youtube>_4bXk8JjQSk</youtube> | <youtube>_4bXk8JjQSk</youtube> | ||
Line 63: | Line 79: | ||
<youtube>va1beT6sxLs</youtube> | <youtube>va1beT6sxLs</youtube> | ||
+ | |||
+ | |||
+ | Here is a short video of how to connect a button and how to read a digital value from the ESP8266_D1_Mini with [[MicroPython]]. | ||
+ | |||
+ | <youtube>Cb_nYYs-pag</youtube> | ||
+ | |||
+ | [[Category:Tutorials]] |
Latest revision as of 15:11, 12 June 2024
Contents
- 1 Digital Input and Output with MicroPyton and ESP32/ESP8266
- 2 Instructional Videos
- 2.1 Digital Output: Adding an external LED to the controller
- 2.2 Digital Output: Connectin an external LED (old version using WebREPL **)
- 2.3 PWM Output: connecting a servo and and LED
- 2.4 PWM Output: connecting a servo (old version using WebREPL **, 14:40)
- 2.5 PWM Output: creating sounds
- 2.6 Digital Input - connecting a switch and a push-button **
Digital Input and Output with MicroPyton and ESP32/ESP8266[edit]
In this part of the tutorial, we explain how to control digital outputs and how to read digital inputs using MicroPyton on ESP32/ESP8266. This includes switching the state of the GPIOs (general purpose input output) and also how to create a pulse width modulation output for changing the brightness of an LED or for controlling a servo.
Success criteria[edit]
- you can set a GPIO pin to on or off from the python prompt
- you can write a loop to blink an external LED
- you can use pulse width modulation to control the intensity of an LED
- you can use pulse width modulation to control a servo that can be directly driven from the ESP Module
- you can read in the status of a GPIO
- you can connect a switch or a push-button and read its status into a variable
Related Components[edit]
The components are related to the LMUBox. For more components, see the Hardware List. Many of the pages on actuators and sensors include additional examples.
Microcontroller[edit]
- ESP8266 D1 Mini
- ESP32 Web Kit with integrated OLED Display from Heltec
- ESP8266 ESP-12F NodeMCU Module from AZDelivery
Actuators[edit]
- LEDs in different colors to connect externally
- RGB LED multi-color LED
- LED Ring NeoPixel
- Piezo Speaker
- Speaker
- SG90 Servo Micro Servo Motor
- Stepper Motor and ULN2003 28BYJ-48 ULN2003 5V Stepper Motor + ULN2003 Driver Board
- IRF520 Module Power MOSFET switching module ('electronic relay')
Sensors (and physical controllers)[edit]
- push button
- Switch
- PIR Sensor passive infrared motion sensor
Instructional Videos[edit]
The videos are a first test... the ones marked with ** will be replaced over the next months with new versions.
If you use the ESP8266_D1_Mini have a look at this file about which Pins to use: https://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/basics.html
Digital Output: Adding an external LED to the controller[edit]
In this video on youtube (30:30) we show how to connect an LED and how to control it from MicroPython: https://youtu.be/0KGgYsEZcZM
Here is a short video of how to connect and control an LED on the ESP8266_D1_Mini.
If you use the ESP8266_D1_Mini have a look at this file about which Pins to use: https://micropython-on-wemos-d1-mini.readthedocs.io/en/latest/basics.html
Digital Output: Connectin an external LED (old version using WebREPL **)[edit]
In this video on youtube (16:54) we show how to connect an LED and how to control it from MicroPython: https://youtu.be/G6HZ1etMRbM
PWM Output: connecting a servo and and LED[edit]
In this video on youtube (45:39) we explain the concept of pulse width modulation (PWM) and how to program it in MicrpPython. We show how to use PWM to control a servo and the brightness of an LED: https://youtu.be/XovIHYo7s1A
PWM Output: connecting a servo (old version using WebREPL **, 14:40)[edit]
PWM Output: creating sounds[edit]
In this video on youtube (23:56) we explain how to create a sound on a digital output pin. We have two versions, one with the sleep function and one with pulse width modulation (PWM) in MicrpPython. We also show how to add an PAM8403_Stereo_Amplifier: https://youtu.be/HPQMvL1SP_c
Digital Input - connecting a switch and a push-button **[edit]
In this video on youtube (30:31) we explain how to read in digital inputs in MicrpPython. We show how to connect a switch and a push-button and also explain the basic concept of a pull-up resistor: https://youtu.be/va1beT6sxLs
Here is a short video of how to connect a button and how to read a digital value from the ESP8266_D1_Mini with MicroPython.