User Tools

Site Tools


latinet:unicaes:workshops:sensors-23

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
latinet:unicaes:workshops:sensors-23 [2024/09/13 21:03] harley.laralatinet:unicaes:workshops:sensors-23 [2024/09/13 21:57] (current) harley.lara
Line 7: Line 7:
 Now, we're stepping into the practical aspect of our workshop, focusing on Pulse Width Modulation (PWM) output with the ESP8266. PWM isn't just about adjusting the brightness of an LED; it's a versatile method of communication. Through this segment, you'll grasp how PWM operates as a form of control, allowing us to transmit information using varying pulse widths. This will come to life as we demonstrate PWM in action, using an attached LED as an illustrative example. Now, we're stepping into the practical aspect of our workshop, focusing on Pulse Width Modulation (PWM) output with the ESP8266. PWM isn't just about adjusting the brightness of an LED; it's a versatile method of communication. Through this segment, you'll grasp how PWM operates as a form of control, allowing us to transmit information using varying pulse widths. This will come to life as we demonstrate PWM in action, using an attached LED as an illustrative example.
  
-<imgcaption image1|ESP8266 with Blink Demo - Breadboard>{{https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-blink_bb.png?400 |}}</imgcaption>+<imgcaption image1|ESP8266 with Blink Demo - Breadboard>{{ https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-blink_bb.png?400 }}</imgcaption>
  
-<imgcaption image2|ESP8266 with Blink Demo - Schematic>{{https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-blink_schematic.png?400 |}}</imgcaption>+\\ 
 + 
 +<imgcaption image2|ESP8266 with Blink Demo - Schematic>{{ https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-blink_schematic.png?400 }}</imgcaption>
  
 ===== 2. Libraries ===== ===== 2. Libraries =====
Line 28: Line 30:
 With these common sensors, we don´t need to reinvent the wheel. There are plenty of good tutorials out there on how to use this sensor. One we link here: [[https://wiki.dfrobot.com/Capacitive_Soil_Moisture_Sensor_SKU_SEN0193|Capacitive Soil Moisture Sensor - DFRobot Wiki]] There you will be able to learn how to integrate the sensor into your software as well as how to use it in the real world. Just keep in mind the electronics on top are not protected from the environment. Water shouldn't touch that part! With these common sensors, we don´t need to reinvent the wheel. There are plenty of good tutorials out there on how to use this sensor. One we link here: [[https://wiki.dfrobot.com/Capacitive_Soil_Moisture_Sensor_SKU_SEN0193|Capacitive Soil Moisture Sensor - DFRobot Wiki]] There you will be able to learn how to integrate the sensor into your software as well as how to use it in the real world. Just keep in mind the electronics on top are not protected from the environment. Water shouldn't touch that part!
  
-<imgcaption image3|Wiring of the analog sensor>{{ :latinet:unicaes:workshops:capacitive-soil.png?400 |}}</imgcaption> + 
-<imgcaption image4|Schematic>{{ :latinet:unicaes:workshops:capacitive-soil_schem.png?600 |}}</imgcaption>+<imgcaption image3|Wiring of the analog sensor>{{ https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-soil_bb.png?400 |}}</imgcaption> 
 +<imgcaption image4|Schematic>{{ https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-soil_schematic.png?400 |}}</imgcaption>
  
 We also prepared a little sketch for you. Try to understand it. A good way to do so is to look up function documentation in the Arduino Documentation: We also prepared a little sketch for you. Try to understand it. A good way to do so is to look up function documentation in the Arduino Documentation:
  
-<file ino read-analog.ino+<WRAP center round info 40%
-// the setup routine runs once when you press reset: +Demo code available in Github [[https://github.com/EOLab-HSRW/intro-to-iot/blob/master/examples/soil-moisture/soil-moisture.ino|Soil moisture]] 
-void setup() { +</WRAP>
-  // initialize serial communication at 115200 bits per second: +
-  Serial.begin(115200); +
-}+
  
-// the loop routine runs over and over again forever: 
-void loop() { 
-  // read the input on analog pin 0: 
-  int sensorValue = analogRead(A0); 
-  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 3.2V): 
-  float voltage = sensorValue * (3.2 / 1023.0); 
-  // print out the value you read: 
-  Serial.println("voltage: " + voltage); 
-  Serial.println("value: " + sensorValue); 
-   
-  delay(1500); 
-} 
-</file> 
  
 ==== 3.2. 1-Wire (ex. temperature sensor) ==== ==== 3.2. 1-Wire (ex. temperature sensor) ====
Line 79: Line 66:
   * Here you can find a library for the sensor: [[https://github.com/adafruit/Adafruit_VL53L0X|Adafruit VL53L0X]]   * Here you can find a library for the sensor: [[https://github.com/adafruit/Adafruit_VL53L0X|Adafruit VL53L0X]]
  
-<imgcaption image5|ToF Breadboard>{{ :latinet:unicaes:workshops:tof_bb.png?400 |}}</imgcaption> +<imgcaption image5|Schematic>{{ https://raw.githubusercontent.com/EOLab-HSRW/intro-to-iot/master/diagrams/wemos-tof_bb.png?400 |}}</imgcaption>
 Task: Try to get the sensor to work with your microcontroller. Task: Try to get the sensor to work with your microcontroller.
 +
 +<WRAP center round info 40%>
 +Demo code available in Github [[https://github.com/EOLab-HSRW/intro-to-iot/blob/master/examples/tof/tof.ino|ToF sensor]]
 +</WRAP>
  
 ==== 3.3. Good to know ==== ==== 3.3. Good to know ====
latinet/unicaes/workshops/sensors-23.1726254183.txt.gz · Last modified: 2024/09/13 21:03 by harley.lara