POTENCIOMETRO

What is a potentiometer?

potenciometro

A potentiometer is a variable resistor. In other words, an electronic component that allows the intensity of the current (the amount of electricity) circulating around a circuit to be regulated. For example, if we want to control the intensity of the current that passes through a circuit and makes the LED light up, we can connect a potentiometer and, according to which way we turn it, we will see how the brightness of the LED varies in relation to the varying intensity of the current. Potentiometers are used to regulate many devices, such as in audio equipment for controlling the volume.

The potentiometer generally serves to adjust a value within a desired range, which is highly useful. We will give two examples that use the potentiometer so that you can discover what it can do.  Let´s get to work!You will need:

  1. 1 x ZumBloq Potentiometer
  2. 1 x ZumBloq LEDs
  3. 1 x ZumBloq Buzzer
  4. A ZUM BT 328 controller board or one compatible with Arduino UNO
  5. A USB cable
potenciometrozum

Got everything? Let´s get started:

Example 1

Making the blinking speed of an LED vary using the potentiometer

Remember what we did to make an LED flash on and off? For sure you will have changed the time delay to make the blinking slower or faster. In this example, we will change the speed of that flashing on and off using the potentiometer.  To do this, we will connect the LED to digital pin 3 and the potentiometer to analogue pin A1 as this connection diagram shows:

ZUM-9-8

Remember that the potentiometer is a sensor, which is why it´s recommended that you assign a variable to it in order to read its possible values:

As we have said before, a variable that contains the values of the potentiometer is declared in the program. We will make the LED flash on and off, but instead of making it wait for a fixed period of time between on and off, we add the value that the potentiometer has at that moment (which depends on what position we have turned it to) to the waiting time. Using such a simple method as this, we can vary the blinking speed of an LED. Now we know how to make our own Christmas lights!

Example 2

Varying the tone of the buzzer using the potentiometer

In this exercise, we will select the tone, and therefore, the note of the buzzer by turning the potentiometer. We will use a new block for this which is called map. This block will be very useful to us in the future, as it allows us to convert one range of values to another. To give you a better understanding: the potentiometer is an analogue component that give us values between 0 and 1023. In the last example, this meant that we were varying the LED blinking between 0 and 1023 milliseconds, 1 second approximately. This value is ok, but  what would happen if we wanted to adjust the LED blinking to between 0 and 10 seconds? The solution is to use the map block:

But not everything is perfect, the greater the range to be mapped, the lesser resolution we will have. In other words, it will vary the value more with each small turn of the potentiometer, so we won´t be able to make very precise adjustments.     To carry out the next exercise, we will connect the potentiometer to analogue pin A1 and the buzzer to digital pin 3, as shown in this diagram:
ZUM-6-8

Now we will use the advanced buzzer block. This block is very similar to the one we have been using, only instead of allowing us to select notes, it allows to select the frequency of the buzzing, so we can create our own tones. We want the frequency of the buzzing to be between 0 and 20000, which is why  we will have to map the potentiometer between those values:

As the advanced buzzer make different tones according to its frequency, we need to place the control variable that we have declared in the tone tab.

Now you know how to handle the potentiometer. You will have seen that the potentiometer can be of great use to us for varying different values and elements in our projects. From varying the intensity or the time of blinking light, to varying the sound of a buzzer, or selecting different modes on a machine… Although digital electronics have progressively replaced analogue controls, you can still find many examples in your home which use potentiometers…  Can you think of any?  Of course you can!

2 thoughts

  1. Hello,

    I have problem with UPLOADING the code from the the bitbloq UI on my PC to the Robotic Primer Kit I purchased from bq.

    things were ok until the first time I tried to use bluetooth controler. And then the code is not loading anymore, the red lights on the board flash when I select “Programar” on the web interface, but then the blue lights that use to flash do not flash anymore and the board keeps the old code.

    After a lost investigation, I decided to disconnect the bluetooth module and it worked and I could upload code.

    Today again I had the same problem, I completely removed the bluetooth module again completely. I could upload the code once, but then afterwards it was completely impossible. I get the same situation as before and the code on the board is never updated.

    I also realize that when I hit once programar it stays GREY aftwards and I can not select it again. I have to bitbloq Serial Upload application and refresh and select again the por so that I have the option to PROGRAMAR active again.

    Please help. My son is in distraught.

    Gracias

  2. Julián Caro

    Hello Guive.

    First of all. Thanks for your feedback.

    You can’t program the code using the bluetooth controller conected to the pin 0. That’ s because that pin (RX->pin 0) is normally used to program your board. When you use your bluetooth, the board receives the information through this pin.

    The solution: Each time you program your board keep in mind you must disconnect the bluetooth controller of pin 0.

    About your problem with the bitbloq Serial Upload application. Sometimes, when the computer lost the internet connection you need refreshing the bitbloq Serial Upload application. Try to not minimize the Serial Uploader. We know the problem and we are working to solve the problem and improve this system.

    Hope you enjoyed :).

    If you have any problems you can ask us here, or also in our community on google+ https://plus.google.com/u/1/communities/110778922976735717392

Comments are closed.