Lego Gentle_&_Sound_Bots

How gentle can a robot be? What is the audible range of the human ear? How deep can we dive? Lego Series #09

J3
KidsTronics
11 min readMay 25, 2019

--

Data wires? In this ninth Lego’s Episode we’re gonna answer these questions:

What is Data Wire? What is sound? How does our ear work? Why doctor do auscultation? How much pressure our body support under water? How high can you hear?

Are you willing to take the ultimate plunge for the sake of science? No? An Egyptian did!

All these questions will be deal in this very short Lego episode!

Nothing related? Think again… Jump to videos? See youtube channel — click here;

Keep reading though:)

Here is our proposal: GentleBot and SoundBot \o

Meet GentleBot: It approaches the wall gently; there is no need to rush;)

Meet SoundBot: it reproduces the frequencies we can hear. only in the range of 20 to 20k Hz. Logically ;)

First thing first, let’s see some theory…

Control Theory

Image from https://gifer.com/en/WtXF

Do you notice the interconnection between these tasks above?

The first is the input (take a photo); then the system processes the digital image; and finally, the printer provides the output sheet.

Input, processing, and output. This is a control system theory!

Control theory in control systems engineering is a subfield of mathematics that deals with the control of continuously operating dynamical systems in engineered processes and machines. The objective is to develop a control model for controlling such systems using a control action in an optimum manner without delay or overshoot and ensuring control stability. (from https://en.wikipedia.org/wiki/Control_theory)

Translating into Lego lingo:)

So, in Lego’s dialect we can read a sensor (say IR sensor), processing this data in the Lego’s brain (EV3 Intelligent Brick), reacting by using an actuator (Move Steering Block), right?

Input is the first data we need to read in any system. It is the step where the data moves into that system. We call it input step because it is the point that data accesses the system. The process is the action of handling or converting the input into a more useful form; it is the step where data is transformed and shaped. Output involves producing useful information. It is basically the outcome of the input after processing it.

How can I change my data dynamically in Lego? Answer: using data wires!

data wires? What the heck is this?

. Data wires pass information(input)from one block to another(output);. Using data wires you can change a block's setting while a program is running;. Data wires are one of the most powerful EV3 programming features;. You can use variables instead of data wires to pass information between sequences;). Learning how to use data wires will open up many more possibilities for your program:). Be specially careful with data wires that pass into or out of Loop blocks and Switch Blocks (read multitask below if you're not sure what to watch out for;)

EV3 Intelligent Brick requires information — or data — to perform an action. Some blocks create data that can be used by other blocks.

Data wires take output data from one block and use it as the input data for other blocks.

Now, for the first time in this Lego Series, we will use data wire in our toolbox. For this we will use a program that moves the Tribot forward and then as it gets closer to the wall (or obstacle) will slow it down, activate the Touch Sensor and stop, exiting the Loop — Touch Sensor:

GentleBot_v1 (Touch Sensor — Compare — States)

The key to this program is that the speed of the Tribot v1.0 depends on how far it is from the obstacle. As the robot moves closer to the obstacle, its speed smoothly decreases until it stops.

Now let’s suppose the case that if the robot touches the obstacle the alarm goes on. So you have to avoid contact with the wall or obstacle. How to perform this? Using Logic Switch.

Here is the solution:

GentleBot_v2 (Logic Switch)

We’ll start by making the Tribot move forward with the power set to 75 and then stop when the reading from the infrared Sensor is less than 20.

But this code has a failure :( it keeps running indefinitely since the touch sensor is not activated. How to solve this?

GentleBot_v3 (Logic Switch, data wires and Loop Block)

The GentleBot v3 uses an Infrared Sensor block to read the proximity to the obstacle, so you can use this same block to decide when to exit a loop.

The Loop Block’s Logic mode lets you choose when to exit the loop using a Logic value from a data wire. The Loop condition is always checked after the body runs, so those blocks will run at least once even if the value on the data wire is true from the beginning.

Using data wires

The ultrasonic sensor has a single output plug that measures the distance to the nearest detected object; drag the output plug to the Move Steering block’s Power parameter to attach the data wires.

. Each input plug can be connected to only one output plug
(otherwise the block receiving the the output wouldn't know which value to use);
. An output plug can be connected to more than one input plug (there's no problem with passing the same value to multiple blocks)

SoundBot: it reproduces the frequencies we can hear. only in the range of 20 to 20k Hz!

We will use the Tribot’s wheels as volume and frequency controls.

We’re gonna use APKPure App to upgrade Signal Generator for comparison purpose so you will realize that the sounds are equivalent. try yourself in your Android device!

Sound Study: Infra & Ultra Sound

The human ear listens for frequencies between 20Hz (lowest frequency) and 20000Hz (higher frequency). Using as reference human hearing, we call infrasounds sounds with frequencies lower than 20 Hz And sounds over 20kHz we have the ultrasound.

The terms dB and frequency are used to describe the sound level and cycle numbers of a sound wave in one second.

What are dB and frequency?

To clarify more about the technical words used to describe facts about hearing, we have collected a few keywords about dB and frequency.

Frequency
The sound frequency is the number of cycles of a sound wave per second. The unit of measure is hertz (Hz) and the sound frequency increases as the number of cycles per second increases. The vibrations between 20 and 20,000 cycles, per second, are considered as the sound of a person with normal health. Acute sounds are those emitted by a flute or the song of a bird. And the bass sounds are those produced by loud distant thunderstorms or the sounds of a guitar.

Decibéis (dB)
The terms dB (decibels) and the decibel scale are used worldwide to measure the sound level. The decibel scale is a log scale, where the doubling of sound pressure corresponds to 6 decibels at the level rise.

It is important to understand that the term dB can have different meanings and does not have a fixed unit such as those related to voltage, meter, and the like. The unit of dB will depend on the context in which it is used.

Examples of different sound intensities expressed in dB (HL), that is, in decibels of sound level:

180 dB: Rocket Takeoff
140 dB: Jet engine in motion
120 dB: Rock band
110 dB: High thunderstorms
90 dB: Urban traffic
80 dB: radio at loud volume
60 dB. Normal conversation
30 dB: Soft whisper

Percussion in Medicine

Is a method of tapping on a surface to determine the underlying structures, and is used in clinical examinations to assess the condition of the thorax or abdomen. It is one of the five methods of clinical examination, together with inspection, palpation, auscultation, and inquiry (https://en.wikipedia.org/wiki/Percussion_(medicine))

Doctor percuss all area in the intercostal space and look for abnormal notes.

Percussion: is done with the middle finger of one hand tapping on the middle finger of the other hand

Acoustic Emission (AE) Inspections in Engineering

Acoustic Emission (AE) testing is a powerful method for inspecting and monitoring the behavior of equipment and materials performing under stress.

Materials talk when they are in trouble. Through AE testing, engineers can listen to the sounds of cracks growing, fibers breaking, and many other modes of active damage in stressed materials.

Small-scale damage is detectable long before failure, so AE can be used as non-destructive testing (NDT) inspection technique to find defects during structural proof tests and plant operations before serious damage occurs.

Hearing, How it works?

Image from https://www.britannica.com/science/cochlear-implant/media/881816/530

Sounds enter your ear in the ear or pinna, the outer part which serves as the capture and pre-amplification of the sound. It travels down the auditory canal, that place where the Eustachian tube (a narrow pipe that connects the middle ear to the back of the nose) act as a pressure-equalizing valve for the middle ear. From here, the wavelengths of sound strike your eardrum (tympanic membrane), an impenetrable wall of taut skin that vibrates as sound strikes it. Past that, three teensy weensy bones, the hammer, anvil and stirrup rest, who, along with the eardrum, comprise the middle ear (pink). These bones transfer the vibrations of the eardrum into the inner ear, mainly the cochlea. That converts vibrations into auditory messages to be delivered to the brain. The inner ear translates the physical vibration into an electrochemical impulse that goes to the brain and this is the end of the process! You can hear now!

Whenever a sense of pressure or fullness in the ear develops, a very useful maneuver and may be repeated as often as necessary, is forcibly blow air through the Eustachian tube into the middle ear by pinching the nose closed and popping the ear. This is known as self-Inflation of the Ears.

And why should I bother you about it?

To understand that cavities with compressed air in our bodies (like lung and ear) suffer when subjected to pressure differences.

And that’s why doctor do percussion to hear different sounds patterns that tell him if the lung is filled with air or liquid :/

Like a drum…We are hearing the sound under pressure… And how about underwater?

How deep can we dive?

1,000 Feet (305 meters) Down: Man Sets New Deep-Dive Record.

Most recreational scuba divers only dive as deep as 130 feet (40 meters),

Such depths are associated with a number of health risks, such as decompression sickness (also known as the bends) and nitrogen narcosis from excess nitrogen in the brain. Leave it to trained professionals, please.

What is the sound of the heart? and the sound of the lung?

Breath and cardiac sounds are two major bio sound signals.

Heart sounds are produced by the movement of some body parts such as heart valve, leaflets, and the blood flows through the vessels, whereas lung sounds generate due to the air in and outflow through airways during the breathing cycle.

These two signals mostly superimpose with each other, so the separation of these heart sound signals (HSS) and the lung sound signals (LSS) is of great research interest.

Vision: Lego’s Text Display

To present our experiments, we use the display to show the frequency and volume of the sounds produced.

While we can specify the start of the text in pixels we can also use GRID MODE.

For displaying text, easier to use grid mode Lego EV3 divides the screen grid into 22 columns horizontally (x-axis) starting from 0 to 21; 12 rows vertically (y-axis) starting from 0 to 11; Each row can display 1 row of text.

And that’s all, folks!

I hope our experiments have aroused curiosity in young people. Until the next episode with more science and Lego’s entertainment o/

Bye!

Download All Files For This Project

Related Posts:

01º Lego Episode — Our Startup’s Journey — Invaders and Invasions?

02º Lego Episode — Timmyton Lego-Learning-By-Playing — L2BP Series

04º Lego Episode — Lego MotionsTribot v 1.0Seeing Your Creation Move — Move Steering Block

05º Lego Episode — Lego Motions Move Tribot Around — And Backward…Five Programs Files

06º Lego Episode — Lego SensorsTouch N Color — Two out of five human senses — Touch N Sight

07º Lego Episode — Lego Sensor LineFollower — Line Follower Tribot v1.0

08º Lego Episode — Maze Solving Robot v1 — Lego Solution Right-Wall-Follower-Robot

09° Lego Episode — Gettle_&_Sound_Bots — How gentle can a robot be? What is the audible range of the human ear? How deep can we dive?

10° Lego Episode — Data Logging — Data Collection and the EV3

11º Lego Episode — Binning the LineFollower Code — Binning: Arithmetic To Map Sensor Reading

12º Lego Episode — A Proportional LineFollower Robot — Advanced Math To Improve Your Robot’s Steering

13º LEGO Theory — Theory of Multitasking — A very Useful Programming Technique

14º LEGO formula — Normalizing Data — Converting Data to Use The Same Range

15º Lego Episode — PID — The Ultimate Line Follower — Algorithm for your EV3 PID Line Follower Robot

16° Lego Meets Pixy Episode — How to Connect Your Inexpensive Camera Module to Lego

18° Lego Episode — GEARS & WORMS — Geartrains & Worm & Clutch Gears

23° Lego Episode — Differential Explained — How Differential Works?

24° Lego Episode — PitBot — A Star Is Born — Working at The First Structure in Our Sparring Robot

25° Lego Episode — PitBot Is Agressive? Well, No Worries! — Making PitBot bite!

26° Lego Episode — Dancing Good w/ PitBot — All The Secret for Replicate This Awesome Robot

27 ° LEGO Episode — Sumo Arena is Ready! — Here is the playing arena for Arduino x Lego

28 ° LEGO Episode — Pick Pitbot Up! — Our Robot Are Leaving Body & Paint Shop

28 ° LEGO — B — Episode — Pitbot Battery & Sensor Setup — Preparing The infrastructure for running Arduino code

29 ° LEGO Episode — Bridging All Sensors Together — Pitbot — Collecting All Codes for the Final Act of Giving Behaviors to Robot

Credits & References

Online Tone Generator

Hearing from The Open University

Eustachian Tube Dysfunction from Baylor College of Medicine

http://mohamed-discoverwhatyouknow.blogspot.com/2010/05/input-processing-output-systems.html

Segredos do ouvido são revelados por nova tecnologia

Multitasking

I’ll discuss some program flow rules in a future post. But for now, knowing that a data wire that starts inside a Loop Block and connected to a block outside the Loop block has a value only when the Loop block finishes.

--

--

J3
KidsTronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!