Skip to content

Latest commit

 

History

History
175 lines (108 loc) · 3.83 KB

Workshop.md

File metadata and controls

175 lines (108 loc) · 3.83 KB
marp
true

Internet of Things Workshop

Salinity Sensor Prototype

ESP32 & I2C

bg


Salinity Sensor

bg 90% Salinity Sensor photo bg 90% Salinity Sensor photo


Salinity Sensor

bg 95% Salinity Sensor scheme

Vout=(R4/R3R4)*Vin

Vout=(R10/R7)*(V2-V1)


Wheatstone bridge

bg right 95% Wheatstone bridge scheme

  • Two voltage dividers
  • Vout=(R4/R3R4)*Vin
  • Only enabled when needed

Amplifier

bg right 95% Amplifier scheme

  • Voltage followers
    • Stable reading
  • Differential amplifier
    • Vout=(R10/R7)*(V2-V1)

ATtiny

bg right 95% ATtiny scheme

  • Reads Amplifier Output
  • Moving Average Filter
  • Sends Reading Over I2C

ESP32 DOIT V1

  • Microcontroller
  • Arduino + WiFi & Bluetooth
  • 30 pins

bg right fit ESP32 DOIT


Setting up the Arduino IDE

  1. https://www.arduino.cc/en/software
  2. Open "File > Preferences > Additional Board Manager URLs" and add: https://dl.espressif.com/dl/package_esp32_index.json
  3. Open the Boards Manager at "Tools > Board > Boards Manager", search for "ESP32" and press the install button for "ESP32 by Espressif Systems"

Testing Arduino IDE

  1. Select "DOIT ESP32 DEVKIT V1" at "Tools > Board"
  2. Select the correct COM port under "Tools > Port"
  3. Choose an example program in "File > Examples > Examples for DOIT ESP32 DEVKIT V1 > WiFi > WiFiScan"
  4. Program the code to the ESP32 with the Upload button (➡)
  5. Open the Serial Monitor via "Tools > Serial Monitor" and set the Baud-rate to "115200 baud"
  6. If you can see the nearby WiFi networks everything is working!
Source: https://microcontrollerslab.com/install-esp32-arduino-ide/

Soldering the Salinity Sensor

bg 95% Salinity Sensor photo bg 95% Salinity Sensor photo


bg 70% Component placement


Connecting to the Salinity Sensor

Using I2C and an ESP32


I2C

  • I2C = Inter-Integrated Circuit
  • Invented in 1982 by Philips
  • SDA = Serial Data Line
  • SCL = Serial Clock Line
  • Every target has his own address '' bg right fit I2C example connection

bg fit 98% Salinity Sensor connected to ESP32


Send to serial monitor

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Send to serial monitor

void setup() {
  Serial.begin(115200); // Open the serial port at 115200 baud
}

/* Send "Salamu, Dunia!" via serial every second. */
void loop() {
  Serial.println("Salamu, Dunia!"); // Send text over the serial port
  delay(1000); // Wait 1000ms or 1s
}