(Mise à jour pour être en accord avec la nouvelle version de la source de la page) |
(update property name) |
||
Ligne 1 : | Ligne 1 : | ||
− | {{ | + | {{Tuto Details |
|SourceLanguage=none | |SourceLanguage=none | ||
|Language=en | |Language=en | ||
Ligne 15 : | Ligne 15 : | ||
|Tags=ESP32, arduino ide, light sensor, arduino, electronics, programming, IoT, objets connectés | |Tags=ESP32, arduino ide, light sensor, arduino, electronics, programming, IoT, objets connectés | ||
}} | }} | ||
− | {{ | + | {{Introduction |
|Introduction=In this tutorial, you will learn how to set up your ESP32 so that it will automatically turn on its internal LED when it’s dark, and vice versa. | |Introduction=In this tutorial, you will learn how to set up your ESP32 so that it will automatically turn on its internal LED when it’s dark, and vice versa. | ||
}} | }} | ||
− | {{ | + | {{Materials |
|Material=- ESP32 board | |Material=- ESP32 board | ||
Ligne 36 : | Ligne 36 : | ||
|Tools=- computer with Arduino IDE installed | |Tools=- computer with Arduino IDE installed | ||
}} | }} | ||
− | {{ | + | {{Separator}} |
− | {{ | + | {{Tuto Step |
|Step_Title=Install Arduino IDE | |Step_Title=Install Arduino IDE | ||
|Step_Content=You will need to use Arduino IDE to code and upload the firmware onto your ESP32 board. | |Step_Content=You will need to use Arduino IDE to code and upload the firmware onto your ESP32 board. | ||
Ligne 43 : | Ligne 43 : | ||
Download the software by visiting [https://www.arduino.cc/en/Main/Software? Arduino IDE] > Scroll down until you see the “Download the Arduino IDE” section and choose the version based upon your operating system (e.g. If you have Windows 7, choose “Windows Installer” / if you have Windows 10, choose “Windows app”) > On the next page choose “Just download” and run the installation files. | Download the software by visiting [https://www.arduino.cc/en/Main/Software? Arduino IDE] > Scroll down until you see the “Download the Arduino IDE” section and choose the version based upon your operating system (e.g. If you have Windows 7, choose “Windows Installer” / if you have Windows 10, choose “Windows app”) > On the next page choose “Just download” and run the installation files. | ||
}} | }} | ||
− | {{ | + | {{Tuto Step |
|Step_Title=Prepare the ESP32 board on your computer | |Step_Title=Prepare the ESP32 board on your computer | ||
|Step_Content=Follow the [https://github.com/espressif/arduino-esp32/blob/master/README.md#installation-instructions instructions provided on GitHub] for your Operating System. For example, if you have Windows 7 or 10, choose “Instructions for Windows” / if you have a MacBook, choose “Instructions for Mac” | |Step_Content=Follow the [https://github.com/espressif/arduino-esp32/blob/master/README.md#installation-instructions instructions provided on GitHub] for your Operating System. For example, if you have Windows 7 or 10, choose “Instructions for Windows” / if you have a MacBook, choose “Instructions for Mac” | ||
Ligne 50 : | Ligne 50 : | ||
|Step_Picture_00=Energy_saving_house_with_ESP32_11.PNG | |Step_Picture_00=Energy_saving_house_with_ESP32_11.PNG | ||
}} | }} | ||
− | {{ | + | {{Tuto Step |
|Step_Title=Check that the board is correctly configured | |Step_Title=Check that the board is correctly configured | ||
|Step_Content=Launch Arduino IDE and select “ESP32 Dev Module” from the Tools menu > Board. | |Step_Content=Launch Arduino IDE and select “ESP32 Dev Module” from the Tools menu > Board. | ||
Ligne 94 : | Ligne 94 : | ||
|Step_Picture_01=Energy_saving_house_with_ESP32_3.PNG | |Step_Picture_01=Energy_saving_house_with_ESP32_3.PNG | ||
}} | }} | ||
− | {{ | + | {{Tuto Step |
|Step_Title=Wiring the photoresistor to the ESP32 | |Step_Title=Wiring the photoresistor to the ESP32 | ||
|Step_Content=The shorter leg of the photoresistor is connected to 3V on the ESP32. The other leg is connected to pin VP (or 36) and at the same time to a 1kohm resistor, which in turn is connected to GND on the ESP32. | |Step_Content=The shorter leg of the photoresistor is connected to 3V on the ESP32. The other leg is connected to pin VP (or 36) and at the same time to a 1kohm resistor, which in turn is connected to GND on the ESP32. | ||
Ligne 104 : | Ligne 104 : | ||
|Step_Picture_03=Energy_saving_house_with_ESP32_7.PNG | |Step_Picture_03=Energy_saving_house_with_ESP32_7.PNG | ||
}} | }} | ||
− | {{ | + | {{Tuto Step |
|Step_Title=Programming on tuniot | |Step_Title=Programming on tuniot | ||
|Step_Content=Let’s create a program that turns the internal LED on and off depending on the amount of light recorded by the photoresistor. More precisely, the LED will be on when it’s dark, and off when it’s light. | |Step_Content=Let’s create a program that turns the internal LED on and off depending on the amount of light recorded by the photoresistor. More precisely, the LED will be on when it’s dark, and off when it’s light. | ||
Ligne 120 : | Ligne 120 : | ||
|Step_Picture_00=Energy_saving_house_with_ESP32_8.PNG | |Step_Picture_00=Energy_saving_house_with_ESP32_8.PNG | ||
}} | }} | ||
− | {{ | + | {{Tuto Step |
|Step_Title=Programming on Arduino IDE | |Step_Title=Programming on Arduino IDE | ||
|Step_Content=To upload the code on Arduino IDE, click on the “Copy Arduino code into clipboard” button. | |Step_Content=To upload the code on Arduino IDE, click on the “Copy Arduino code into clipboard” button. | ||
Ligne 130 : | Ligne 130 : | ||
|Step_Picture_01=Energy_saving_house_with_ESP32_10.PNG | |Step_Picture_01=Energy_saving_house_with_ESP32_10.PNG | ||
}} | }} | ||
− | {{ | + | {{Notes |
|Notes=This tutorial has been developed as part of the iTech project, co-financed by the Erasmus + programme of the European Union. | |Notes=This tutorial has been developed as part of the iTech project, co-financed by the Erasmus + programme of the European Union. | ||
For more details contact info@digijeunes.com | For more details contact info@digijeunes.com | ||
}} | }} | ||
− | {{ | + | {{Tuto Status |
|Complete=Published | |Complete=Published | ||
}} | }} |
Auteur Digijeunes | Dernière modification 9/12/2019 par Clementflipo
ESP32, arduino ide, light sensor, arduino, electronics, programming, IoT, objets connectés Energy_saving_house_with_ESP32_1.PNG en none Creation 1
- ESP32 board
- micro USB cable to power the board
- laser cut house (downloadable here)
- Breadboard
- 3 jumper wires (one M/F)
- light sensor
- optional (Led)
- 1kohm resistor
- computer with Arduino IDE installed
You will need to use Arduino IDE to code and upload the firmware onto your ESP32 board.
Download the software by visiting Arduino IDE > Scroll down until you see the “Download the Arduino IDE” section and choose the version based upon your operating system (e.g. If you have Windows 7, choose “Windows Installer” / if you have Windows 10, choose “Windows app”) > On the next page choose “Just download” and run the installation files.
Follow the instructions provided on GitHub for your Operating System. For example, if you have Windows 7 or 10, choose “Instructions for Windows” / if you have a MacBook, choose “Instructions for Mac”
For the “Instructions for Windows” section, you can ignore the following step:
Launch Arduino IDE and select “ESP32 Dev Module” from the Tools menu > Board.
Fetch the Blink example from File > Examples > 01.Basics > Blink.
write int LED_BUILTIN = 2; at the beginning of the code
/*
ESP 32 Blink
Turns on an LED on for one second, then off for one second, repeatedly.
The ESP32 has an internal blue LED at D2 (GPIO 02)
*/
int LED_BUILTIN = 2;
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Finally, upload the code by using the right arrow (→) button at the top right corner of the window, by choosing Sketch > Upload or by pressing Ctrl+U on the keyboard.
The shorter leg of the photoresistor is connected to 3V on the ESP32. The other leg is connected to pin VP (or 36) and at the same time to a 1kohm resistor, which in turn is connected to GND on the ESP32.
Note: if it’s the first time you’re using a breadboard, check out this video to understand how breadboards work.
Let’s create a program that turns the internal LED on and off depending on the amount of light recorded by the photoresistor. More precisely, the LED will be on when it’s dark, and off when it’s light.
For that we need to reach: http://easycoding.tn/esp32/demos/code/
Choose the appropriate blocks to create the code displayed below (see image).
To upload the code on Arduino IDE, click on the “Copy Arduino code into clipboard” button.
then paste the code onto Arduino IDE, and upload it to the ESP32.
If you click on Serial Monitor (top right of the Arduino IDE window, below the “X” button), you should see the value that the photoristor is recording at any given time.
This tutorial has been developed as part of the iTech project, co-financed by the Erasmus + programme of the European Union.
For more details contact info@digijeunes.com
Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #