Today we will make a simple and very engaging experiment. We will use a hidden feature of our button module to check everyday objects for electric conductivity.
Connecting electronic modules
You can either make this lesson with bare button module connected to LOFI Brain or use any other robot construction which contains a button module (eg. Robot Head).
- Button → INPUT1.
- LED → OUTPUT3.
- Power supply → USB cable → computer.
- Crocodile cables connected to the button module.
The button module, in addition to its regular function, can be extended with crocodile cables, and short-circuiting them will act as pressing the button. What is more, the sensitivity of this module is very high so even things that conduct electricity in a very limited way when connected to the cables can be used as physical “buttons”. This way we can experiment with some unusual objects such as fruits, vegetables, plants or even human skin. DO NOT WORRY – there is no chance for an electric shock! Electric load going through the module is very, very, very low.
Our program will make a LED module light up whenever the crocodile cables touch an object which is able to conduct electricity. We will use conditional IF/ELSE block to set the led according to button module readings.
This time condition is met when reading from the button module is higher than 30.
When the button is pressed, the reading from the module is 100 – we simply close the circuit. However, when we use the crocodile cables on objects, the reading depends on the object you clip them to. If you clip the cables to something metal then it will conduct electricity perfectly and the reading will be 100. But if you clip the cables to some kind of fruit, conduction of electricity will be medium (water in the fruit conducts the electricity), so the reading will vary ~20 – 50 or more depending on the conditions.
Try to experiment with connecting crocodile cables to various objects. Remember that each time the object has to close the circuit between two cables.
- Kitchen utensils.
- Fruits and vegetables.
- Hold the cables (touch metal parts) with both of your hands – notice what happens if you grip them firmly, or when your hands are dry or sweaty.
Give one cable to another person, and holding the other cable with your hand try touching hands with the other person.
Let’s make some noise
Since we have measured electric conductivity and turned it into a number (between < 0 and 100), we can then turn the conductivity into anything we want - for example, we can change it into sound. It is as simple as using readings from our button as a parameter of a PIANO block from the sound category.
If your signal is a bit low and does not reach 100, you can amplify the signal by simply multiplying it, eg. by 1.5.
Try drawing something on paper with a thick layer of pencil (soft pencil – B2, B3 and up would be the best). A pencil’s core is made of graphite which conducts electricity. Touch the drawing with crocodile cables to make a musical instrument from your pencil drawing.
If we can make sound with electricity, we can make visuals as well.
Let’s add some orange background. Set color to orange (100,50,0) and draw a rectangle covering whole drawing area.
Our input will be visualized by a white circle. Change the fill color to white (100,100,100) and draw an ellipse in the middle of the drawing area (X:50, Y:50) width and height of the ellipse will be the same as reading from the button module.
In our last experiment let’s display the reading at the center of the drawing board. Change the fill color to black. Note that reading from INPUT1 is used in two different ways – as a text value to display but also as the size to the text.