I’m new here, and very grateful and happy to be part of this community.
I’ve been working my way through the “Arduino Projects Book”, my board details are the following:
I have a question relating to Project 6 the “Light Theremin”. On page 73, it presents the question “What happens if you put a potentiometer in series with pin 8 and the piezo?” – I understand this will allow voltage to be varied on the middle pin, which translates to a variation in amplitude on the signal reaching the piezo, and hence volume of sound emitted by it.
I’m a novice at electronics but thought I would try and draw the circuit for this (see below). My question is, is this correct?
As a follow-up question, I’ve placed a decoupling capacitor in parallel to the potentiometer, similar to the way one is used in combination with a potentiometer in project 5 (“Mood Cue”). I understand capacitors used in this way reduce (decouple) changes caused by components from the rest of the circuit, but don’t understand why these are necessary in both cases, seeing as on the side of lower potential they connect directly to ground?
I would greatly appreciate any rectification of my misconception.
That sounds correct even not knowing exactly what the speaker element is.
Does the project suggest that cap in that place?
What does the code look like? Use the IDE autoformat and the <"code"> symbol in this window.
The diagram in post #1 is not good. The capacitor is connected in reverse polarity. If that is corrected, it will bypass an AC signal around the pot. I think the cap is supposed to couple the signal to the pot so be connected between UNO and the pot. That way it will block a HIGH output from drawing current through the pot/speaker.
@Railroader. I have not tried building the circuit per my diagram, in case it is wrong. I'm apprehensive about straying from the project builds given in the book, in case I screw up some component or something like that.
I will provide the diagram shown in the book for Project 5 (below), as mentioned in my OP. This may clarify my misgivings a bit more. I'm hoping to employ a potentiometer in the same way - as illustrated by the diagram in my OP. I'm just not sure if my diagram is right?
@herbschwarz. Thanks for your input. You are right regarding the capacitor being connected in reverse polarity. I have corrected this in my diagram, see below:
Good.
The 2 schematics are good. Decoupling caps like that are supposed to kill noise from especially a servo. 100 uF across a pot is a lot more then needed but creates nothing bad.
Thank you for your reply. I think I'm getting confused. In your first diagram why should the floating pin (of the pot.) not be connected to ground?
I have not learnt another way to use a capacitor (yet) unless it is in the role of a "decoupling capacitor".
I would argue wrongly I suspect that my last diagram would work without introducing a decoupling capacitor - since the piezo (which is in series with the pot.) would not cause dips in voltage (noise) when drawing current like the servo does in "Project 5 - Mood Cue"?
Any help with unconfusing me would really be... helpful.
I apologize for adding to the confusion. I am confused, but that's kinda my resting state…
I applaud your curiosity, and it is good to take questions raised in the learning materials seriously, as they are often posed to make you think.
In this case, however, it is inconconcionablbe that they just ask, and provide no additional help.
Literally putting a pot in series with the piezo would be my first diagram.
Better would be to wire the potentiometer as a voltage divider. That is your diagram without the capacitor. I will check because it's drawn oddly,
So now I say use the pot as a voltage divider, feed the piezo from the wiper, the other two pot leads go to the signal output pin, and to ground respectively. Other leg of the piezo to ground.
Lose the capacitor, and the rule to pocket is to not get creative until the basics have sunk in.
The materials should have explained better the roll of the capacitor in the other circuits where it was used.
Below is more often how the same circuit would be laid out in a schematic. A schematic shows the connections, but beyond that there are conventions that perhaps your training materials do not follow. You will see more schematics and start to pick up some of the customs around signal flow and labeling and so forth.
Project 5 is using a servo, which contains a small inductive motor. An inductive motor demands a larger amount of current to get it to move. This is generally referred to locked rotor current (LRC). There is an increase amount of current demanded from the servo the instant you command the servo to move. This instantaneous In-Rush Current can cause the supplied voltage to temporarily drop, known as Voltage Sag. To counter this short duration voltage sag, and help the voltage across the potentiometer remain stable, a fairly large capacitor is placed across the pot.
Step 4 states:
When a servo motor starts to move, it draws more current than
if it were already in motion. This will cause a dip in the voltage
on your board. By placing a 100uf capacitor across power and
ground right next to the male headers as shown in Fig. 1, you can
smooth out any voltage changes that may occur. You can also
place a capacitor across the power and ground going into your
potentiometer. These are called decoupling capacitors because
they reduce, or decouple, changes caused by the components
from the rest of the circuit. Be very careful to make sure you are
connecting the cathode to ground (that’s the side with a black
stripe down the side) and the anode to power. If you put the
capacitors in backwards, they can explode.
The passive piezo element used in project 6 is not an inductive load. It can be considered as a small capacitive load. Adding more capacitance is working against your objective of creating sound. The piezo element is not creating the affects of the inductive in-rush current caused by the servo. Therefore, no added capacitance is needed, nor desired.
Thank you both for resolving my doubts and confirming my suspicions.
@2112. The extract you refer to is precisely the exposure I've had to capacitors. I was initially unsure if one should be incorporated into the circuit containing the piezo with a potentiometer. I fully understand why this is now a redundant/unnecessary/even counter-productive component. Thank you.
@alto777. I appreciate the compliment. In my limited forays into electronics, I have indeed come across different conventions. One example that springs to mind is 2 different forms in schematics for drawing a resistor. And I would venture to say that designing circuits is almost an artform, allowing a degree of individual expression in how components and their connections are represented. But as you say given time and experience, I should adopt a more formal approach.
As I tentatively push forward in this field, my main source for learning at present, for good or bad, is the "Arduino Projects Book". That and this so far awesome community. Thank you.
Happy to help. Feel free to ask for any clarification or guidance during your journey for knowledge. It's great to help someone who actually wants to learn.
Don't forget about Google. You can research anything and everything. You could try searching " The purpose of a capacitor", "What does a capacitor do" or "How does a capacitor work".
Have you tested the circuit in your last post?
I'm curious if all the volume control is at the bottom half of the pot swing. Do you notice most of the volume adjustment is at the low end and not much change as you turn it towards maximum volume? You may need an audio taper pot to correct that.
I have moved onto the next project in the book "Project 7 Keyboard Instrument" for the time being. But will no doubt revisit the "Light Theremin" circuit in the future, adding the potentiometer when I do. Rest assured I will report back any findings here. Thanks again for your contribution to this post. : )
PS As a final curiosity, in case the volume adjustment is at the low end, you mention an audio taper potentiometer may be needed, could that be emulated using code (in a sketch) that takes the analog reading from the position of the potentiometer (provided in the kit), and maps it to the range of values of the piezo? A reshuffled circuit would no doubt be necessary to make the Arduino the intermediary between the pot. and the piezo?