Arduino Projects 1: How Does a Device “Think”?
Simple Automatic Control Devices
Any device that includes an arduino microcontroller can be considered a simple automatic control device. There are three essential constituent parts for a simple automatic control device:
- An input unit for collecting signals
- An output unit for sending out signals
- A control unit for processing the signals received (such as a microcontroller).
Let’s draw an analogy between an automatic control device and a person. In a person, signals are sensed through sight, hearing, taste, touch and smell, and then processed by the brain which then outputs responses to each. In this case, the output signal would be the actions of that person.
A microcontroller can output responses as well. Output responses include sound, light and movement (DC Motors, LEDs, servos etc.)
Here is another way to explain it: imagine someone says “hello” to you, and you immediately reply “hello” in return. In this case, your ear is the input unit; your brain is the control unit and your mouth is the output unit.
How can we carry out this whole process (receiving signals, processing signals and then sending out signals) using our microcontroller?
As well as our microcontroller, we simply need an acoustic sensor and a buzzer. The acoustic sensor “hears” a sound, the microcontroller receives a signal and then outputs a signal to the buzzer for it to buzz.
In this case the acoustic sensor is the input unit; the microcontroller is the control unit and the buzzer is the output unit.
Can you tell which components in the kit can be used as input units and which can be used as output units?
Input Units - Sensors
A sensor (also known as a transducer) is a physical unit whose purpose is to sense or detect the characteristics of its environment (such as light, temperature or moisture levels) and then transmit this data to another device.
The three categories of sensor pins are as follows:A protocol pin is also a kind of digital pin. I2C, Serial and SPI are frequently used digital pins.
Control Unit - DFRduino Uno
This microcontroller (as arduino uno) is the control unit. Think of it as the brain of your device.
Output Units - Actuators
There are many different types of actuators. An actuator is a type of device that is responsible for moving or controlling a system or mechanism. It is also the mechanism by which a control system acts upon an environment. It may convert electrical energy into motion, sound or light. A buzzer or speaker are actuators that output sound.
The Relationship Between Programs and Hardware
The input unit, control unit and output unit mentioned above are all hardware. In the context of our person analogy, hardware is the body of our device. However, the brain is much more important as it produces ideas and then controls actions every person takes. Code here functions as the mind of a person. Both body and mind are indispensable to a person.
Digital Signals & Analog Signals in the World of Electronics
The input unit, the microcontroller and the output unit communicate by signals, which in turn are processed by code.
How do input units and controllers communicate with each other? How do controllers communicate with the output units? To answer the above questions, we first need to understand two concepts: digital signals and analog signals.
The Difference between Digital & Analog Signals
A digital signal has two states: HIGH or LOW.
HIGH is a 5V signal and represents “1” (or on).
LOW is a 0V signal and represents 0 (or off).
An analog signal has a range of values.
The analog pins of your microcontroller can have between 0V and 5V is mapped to a range between 0 and 1023. For instance, 0 is mapped as 0V; 1023 is mapped as 5V and 512 is mapped as 2.5V.
“Digital” & “Analog” in a DFRobot Kit
Here are two ways to tell whether sensors in your DFRobot Stater Kit for Arduino are digital or analog:
(1) If a sensor has a green wire it uses digital signal; if a sensor has a blue wire it uses analog signal.
(2) “A” or “D” may be marked on the sensor’s board. “D” represents “digital” and “A” represents “analog”.
I/O Expansion Shield V7.1
Let’s take a look at the DFRobot I/O Expansion Shield. This shield gives us lots of extra pins to connect sensors to.
It stacks neatly on top of your microcontroller, “shielding” it. The diagram below gives you an overview.
Analog and digital pins are marked on the expansion shield.
The area with “A” is for analog sensors, and the area with “D” is for digital ones.
The advantage of the I/O expansion shield is that there are more power and ground pins than those on the bare microcontroller board. This gives you enough power pins to connect various sensors at the same time.
On the expansion shield, there are a row of power pins in red and a row of GND pins in black below the digital pins.
Different colors shown in our DF Kit have different meanings:
Green = Digital signal
Blue = Analog signal
Red = Power
Black = Ground
This session gives you a general idea of what makes our devices work.
Are you excited to get your devices going? You’ll get a chance to in the next lesson!
There is also another arduino starter kit for you to choose.