ELECTRONICS

From Inputs to Outputs

Primary Electronic Components

This are the main components, that will help interconnect
the inputs and outputs to our system.

ESP32

ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. It is created and developed by Espressif Systems, a Shanghai-based Chinese company, and is manufactured by TSMC using their 40 nm process. It is a successor to the ESP8266 microcontroller.

https://en.wikipedia.org/wiki/ESP32

Mobirise
ESP32 - NODEMCU

The prototyping hardware typically used is a circuit board functioning as a dual in-line package (DIP) which integrates a USB controller with a smaller surface-mounted board containing the MCU and antenna. The choice of the DIP format allows for easy prototyping on breadboards. The design was initially based on the ESP-12 module of the ESP8266, which is a Wi-Fi SoC integrated with a Tensilica Xtensa LX106 core, widely used in IoT applications (see related projects).

https://en.wikipedia.org/wiki/NodeMCU

Mobirise
BREADBOARD

A breadboard is a construction base for prototyping of electronics. Because the solderless breadboard does not require soldering, it is reusable. This makes it easy to use for creating temporary prototypes and experimenting with circuit design. For this reason, solderless breadboards are also popular with students and in technological education. Older breadboard types did not have this property.

https://en.wikipedia.org/wiki/Breadboard

This Breadboards replace the PCB (copper based) soldered shields, and a variety of electronic systems may be prototyped by using breadboards, from small analog and digital circuits to complete central processing units (CPUs).

Check this reference of how to build a computer with it:
https://eater.net/

Mobirise
POWER INPUT:

For powering the whole system, we are going to use a breadboard power input. This device will be connected to your 9v power supply through the DC Input Jack, and can divide it into 3.3v and 5v when needed.

It also has a On/Off switch, and a led that indicates if it is On or Off.

To select the voltage you want it to have in the left or right rail, you will use the jumpers, which are this little boxes shaped thins that work to interconnect two wires.

Check this tutorial on how to use it:
https://www.youtube.com/watch?v=i9l51qYtpJM
https://www.youtube.com/watch?v=rMF6oDGZ4zM

Mobirise

What's an Arduino?

(Similar to the ESP32 NODEMCU you are using, but less advanced)
Mobirise



An Arduino or ESP32 development board, works pretty similar to a Food Processor, which depending of what you add into it (INPUTS), and the tools you use (OUTPUTS), it is able to process them in different way to produce different stuff.

Depending of the fruits or food you add and the blades you use, you can turn them into smoothies, juices, frappe, salads, marmalades, etc.

Electronics Concepts:

This are some basic concepts you will need to know for the development of this project. For deeper information visit this link with pretty clear examples made by Sparkfun.

Polarity
and Voltage:

When talking about electricity, we are always going to have a POSITIVE ( + ) and a NEGATIVE ( - ) side, just like in common batteries. This are commonly represented with RED and BLACK wires. RED for the POSITIVE and BLACK for the NEGATIVE.

This positive and negative poles, are called in the circuits as V or VCC (voltage) for the positive and GND (ground) for the negative.

Not all the electronics work with the same Voltage, so we are going to use in this project 3 different Voltages:

9V:
This will be the Voltage that comes from the Power source, and will be connected to the Voltage divider, that will transform it into 5V and 3.3V.

5V:
This is the Voltage that some of our electronics like the Water Pump, the Lights, the Ventilator, and the LCD screen are going to use. 5V is also the Voltage that passes through an USB connector. Saying that, when you connect your ESP32 to a computer, it will receive 5V.

3.3V (3V3):
This is the voltage that will come out of your ESP32, even dough it is powered with 5V, it will always take out 3.3V through its pins. All of the sensors we are using work with 3.3V - 5V, but in this case we are going to use them with 3.3V.

Mobirise
CURRENT AND RESISTANCE:

Imagine you have two buckets with the same amount of water (that would be the Voltage), and each one of them is connected to a hose, but one of them in thiner than the other. 

Then through the thicker hose the water will come out faster than the other, therefore it will have more current (Amps). This happens because the thinner hose generates more resistance than the thicker one.

Let's say that we measure it in liters of water that come out, and that 0.5 Lt x h will come out of the thin one and 1Lt x h will come out of the thick one.

In electronics, current is measured in Amps (Ampers) per hour. And Resistance is measured in Ohms (Ω).

Mobirise
VOLTS, AMPS
AND WATTS:

If the amount of water that fills the bucket is the Voltage (V), and the amount of water that passes through the hose is the Current (Amps), the resulting pressure of them both combined are the Watts.

Suppose you have a 2cm diameter hose and a 1cm diameter hose each connected to a water valve. And you open the valve of the 2cm (2Amps) hose at half power (5V), and the valve of the 1cm (1Amp) hose at full power (10V). Then the pressure that will come out of the two hoses will be the same.

Volts x Amps = Watts
5v x 2amps = 10W
10v x 1amps = 10W

Volts = Watts / Amps
5v = 10W / 2amps
10v = 10W / 1amp

Amps = Watts/Volts
2 Amps = 10W / 5v
1 Amp = 10W / 10v

Mobirise
Mobirise




This Pinout diagram shows to what each of the ESP8266 pins corresponds to.

Some are voltage inputs and / or outputs like "VIN 5V", or just voltage outputs like "3V3". The "GNDs" refer to ground and they are all interconnected inside. "GIOP" (GPIO in other diagrams) stands for general input and output pins (or general purpose inputs and outputs). This means that each of your electronic components, such as sensors and actuators, are generally connected to 1 GIOP pin, a GND, and a Voltage source (5V or 3V3). Electronic components can share the same GND or Voltage pin, but not the GIOP.

The "5V VIN" works to give 5V to other electronics when the ESP8266 is connected via USB,
or to feed 5V to the ESP32 from another source.

Mobirise

Tinkercad

Tinkercad is a free, easy-to-use app for 3D design, electronics, and coding. It's used by teachers, kids, hobbyists, and designers to imagine, design, and make anything!

GO TO: https://www.tinkercad.com/

Mobirise

Schematics and Diagrams

Here you will find the diagrams to connect the different sensors, inputs and outputs for POWAR project.

LED BLINK

The first and easiest Arduino example.

Mobirise
LED

A light-emitting diode (LED) is a semiconductor light source that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons. The color of the light (corresponding to the energy of the photons) is determined by the energy required for electrons to cross the band gap of the semiconductor. White light is obtained by using multiple semiconductors or a layer of light-emitting phosphor on the semiconductor device.

Operating Voltage:        3.3V to 5V

Input type:                     Digital / Analog



ESP8266:

Connect the Positive leg (Long One) to GPIO D3 and connect the other leg, the sort one, to GND using a 220Ω like if it was a wire.

Long Leg:    D3

Short Leg:    220Ω to GND

Mobirise
Mobirise
LDR

https://arduinomodules.info/ky-018-photoresistor-module/

Arduino KY-018 Photoresistor module, used to measure light intensity. It can determine the presence or absence of light.

This module consists of a photoresistor and a 10 kΩ in-line resistor. The photoresistor's resistance will decrease in the presence of light and increase in the absence of it. The output is analog and determines the intensity of light.

Operating Voltage:        3.3V to 5V

Type:
                             Analog


ESP8266:

The LDR photoresistor has no polarity, so both legs work the same.

Connect one of the legs to +3V3 and connect the other one to GND using a 10K resistor like if it was a wire, and also connect that leg to the GPIO A0 using a wire.

LEG 1:     3v3

LEG 2:
    10kΩ to GND + A0


Mobirise
Mobirise
Mobirise
DHT11

https://arduinomodules.info/ky-015-temperature-humidity-sensor-module/

KY-015 Arduino temperature and humidity sensor module, provides a digital serial interface to measure humidity and temperature.

This module consist of a DHT11 digital humidity and temperature sensor and a 1 kΩ resistor. The DHT11 uses an internal thermistor and a capacitive humidity sensor to determine environment conditions, an internal chip is responsible for converting readings to a serial digital signal.

Operating Voltage:        3.3V to 5V

Type:
                             Digital



DHT Library

DHT Library
for ESP8266

To read from the DHT sensor, we’ll use the DHT library from Adafruit. To use this library you also need to install the Adafruit Unified Sensor library. Follow the next steps to install those libraries.

1. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open.

2. Search for “DHT” on the Search box and install the DHT library from Adafruit.

Mobirise

3. After installing the DHT library from Adafruit, type “Adafruit Unified Sensor” in the search box. Scroll all the way down to find the library and install it.

Mobirise
ESP8266:

Connect the Power line (middle) to +3V3 and ground (-) to GND, and signal (S) to GPIO D4 on the ESP8266.

Mobirise

Integrated Circuit:

Here is how the integration of the circuit should look when having
the LED, LDR and DHT sensor connected at the same time.

Mobirise
Mobirise

Created with Mobirise - More