Open creativewitty opened 3 years ago
Hello,
Version 2 of the PCB which is on GitHub has been converted with 'dual pattern' so you can use through-hole resistors (OR surface mount). For the other components like the capacitors, you don't actually need to use them so you can leave unpopulated. They pre-set the amplification on the DAC.
If you wanted to add an analog volume knob, you would use a potentiometer. Hook one side to 3.3v, the opposite side to GND, and the center pin (which is the analog outputs) into the "A0" pin which is the analog. You would need to update the code to read the pin, look for a change in the analog value, and update the volume setting.
Reading an analog pin on the arduino (This will basically follow the Aruduino reference using pin A0) https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/
More info on reading an analog pin, along with diagram (on Arduino Uno) on how to wire it). https://microcontrollerslab.com/analogread-arduino-example/
You would probably do something like the Map() function to map the 0-1028 analog value into a 0-100 for the volume and that will constrain the values to 0-100, and scaled accordingly.
Wow This is great and thank you for your guidance, I should be getting my DACs in the mail today so will start to tinker with em and update my progress.
And For volume I realized MrDiy's code has volume commands too, so maybe I can just use something to control it via mqtt than hardware. but I will still try to achieve the volume option with the analog input. And will post my progress.
Cheers Aktion!
Sorry - I guess I assumed you wanted to override the volume coming from MQTT. I've found that I don't change the volume on these. I run OpenHAB and use a rule to set the volume there on each device when they come online (by watching the LWT topic). I made five of these and put them around my house and LOVE having them.
So you could do the analog with a knob, or you could also do it with two buttons - UP and DOWN - which would be easier to code. When the button is pressed, you just run the volume up by 10 or down by 10.
No I did, i did initially think of overriding that but since I will be using the speakers for alarm too i figured might not be a good idea to have a volume control on it :)
I am using home assistant and it's super easy with the mqtt integration so I will setup something for volume control from within.
I tested the system with a Drok amp and D1 chip and it works like a charm. now time to optimize the setup using the Dac. !
https://user-images.githubusercontent.com/1167235/109852443-c7568300-7c22-11eb-8278-7aabfb7b2606.mp4
Nice work! You could have the knob just override the current MQTT value, then have a rule reset the volume in the morning before the alarm goes off.
Thanks, also wanted to ask you before you used the dac as a solution did you think of anything else to remove the pooping of clicking sound?
I did play with it a little to try resolving the Pop, and finally just spent a few bucks on the DAC. The problem is using the Rx pin. The D1 mini writes it LOW (0 volts) when not playing audio, then writes it HIGH (3.3V) before playback starts. This is the cause for the pop. The analog audio level is millivolts peak to peak, so a 3+V change is a pretty large swing.
Yeah I found the same info on the Interwebs :) But again thank you for taking out time to helping me, Your schematic was really helpful for me. I designed my first pcb. It is just a diff design with dip switches and thru mount resistor slot. very excited.
If you haven't ordered you PCB yet, don't forget to add mounting holes. Nice work on your first board!
Thank you!! and yeah I left them out on purpose for this one. But I might make another to put it our for people and there i will have the mounting holes.
I might even make a video about mqtt and home assistant where i will include this so will definitely leave your link there!
Hey James, MrDiy directed to me to this fork and this looks great. I know a bit about electronics but not as much..
Is there a way to convert the board to components where normal non smd components are required. and say if i wanted to add a poteniometer for volume where would that be implemented?