Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Analog Line Level Preamplifiers , Passive Pre-amps, Crossovers, etc.

Arduino based LDR volume and source selection controller
Arduino based LDR volume and source selection controller
Arduino based LDR volume and source selection controller Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 21st February 2017, 10:14 AM   #711
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
I may be getting this all wrong as I'm reverse engineering, trying to understand what is going on. And at the moment my understanding is so messed up I cannot even see where a maximum current of 7mA can ever flow through any of the LDR LEDs?

If we take the Series LEDs, the datasheet specifies a forward voltage drop of 2.5V @ 20mA, but forgetting that for just a mo we have a 12V analogue supply & assuming Q1/2 are fully ON then that 12V supply is dropping through R7/24 & R9/26 (total 34K2). So if I have my ohms law correct that is a maximum current of 0.35mA excluding the voltage drop over the LED.

When the series sampling side is not being used the Nano sense lines get switched high (+5V) so I guess we have 7V/1K2 = 6mA (Close I guess)

The Shunt side is even more confusing because of the BIAS Pins D7/8 of the Nano and where the current sense signals are taken from given that thier resolution is over the 0-5V range. The max current through the LDR is 12V/35200R = 0.34mA.

When the shunt sampling side is not being used the Nano sense lines get switched high (+5V/Vol Bump) so I guess we have 7V/2K2 = 3.2mA

I MUST have this all wrong, but as I see it the issue is then not in the volume routines but the calibation?

Time for some breadboarding tests
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”
  Reply With Quote
Old 21st February 2017, 11:50 AM   #712
zdr is offline zdr  Belgium
diyAudio Member
 
zdr's Avatar
 
Join Date: Nov 2005
Location: Brussels, Beograd
Quote:
Originally Posted by garym999 View Post
When the series sampling side is not being used the Nano sense lines get switched high (+5V) so I guess we have 7V/1K2 = 6mA (Close I guess)
Hm, where do you see in the code sense lines (PIN_SENSE_*) being switched to output-high? I am also reverse-engineering it and could easily be wrong, but I can these pins being switched only between output mode and input mode:

/******* set high current/low resistance bias range *******/
// LOW = low resistance range
inline void setLSE_Range(byte val) {
pinMode(PIN_SENSE_LSE, val == LOW ? OUTPUT : INPUT);
}
inline void setRSE_Range(byte val) {
pinMode(PIN_SENSE_RSE, val == LOW ? OUTPUT : INPUT);

Unless it's a default value in output mode...
__________________
Custom DIY PCBs, BOM and LDR Firmware:
https://sites.google.com/view/dacgear/
  Reply With Quote
Old 21st February 2017, 12:26 PM   #713
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
So attached are my breadboard tests. They make no allowence for the control via the transistor and show maximum LED currents/minimum LDR resistances for a given sample.

If I read the code right then some of the pins can be used to both read values and offer a 5V output.

On the shunt side if the BIAS pin goes high then the SENSE pin will see a voltage (V2) of over 5V which is outside of the AnalogRead range and could be suspect for the Nano itself
Attached Images
File Type: jpg Breadboard LDR Tests.jpg (177.5 KB, 440 views)
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”

Last edited by garym999; 21st February 2017 at 12:44 PM.
  Reply With Quote
Old 21st February 2017, 01:12 PM   #714
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
Neb,
Forgive me I'm learning to code as I go so as well as trying to understand the project.

Quote:
Originally Posted by zdr View Post
/******* set high current/low resistance bias range *******/
// LOW = low resistance range
inline void setLSE_Range(byte val) {
pinMode(PIN_SENSE_LSE, val == LOW ? OUTPUT : INPUT);
}
inline void setRSE_Range(byte val) {
pinMode(PIN_SENSE_RSE, val == LOW ? OUTPUT : INPUT);

Unless it's a default value in output mode...
Looking at it again I think the default for a pin when changing its mode to OUTPUT is LOW which in that case makes it sink current effectively shorting out the 33K resistors so that means my previous tests were invalid. New tests attached

But it still leaves pins A6/7 exposed to high voltages if the shunts are driven to minimum resistance?
Attached Images
File Type: jpg Breadboard LDR Tests 2.jpg (186.6 KB, 426 views)
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”
  Reply With Quote
Old 21st February 2017, 01:39 PM   #715
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
Regarding my other fault if I remove the Nano and just supply 5V to the board direct the MPC23008 chip still gets hot so that is blown. Which then got me thinking even more...

The A6/7 pins are next to the pins used for the i2C bus. Could they have got spiked by the possible overvoltages on A6/7. Cos the relay driver is still OK

All this thinking is getting out of hand
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”
  Reply With Quote
Old 21st February 2017, 01:50 PM   #716
zdr is offline zdr  Belgium
diyAudio Member
 
zdr's Avatar
 
Join Date: Nov 2005
Location: Brussels, Beograd
Nothing to apologize for, I am not programmer either - I learned a lot with this project

Anyway, if you are trying to get to the bottom of middle volume bumps, I don't think the calibration part is the culprit. People already measured resistance values on each step and they were spot on. The transition between steps while changing low-high resistance mode is the culprit, imho. There is no issue when they happen at exact same point in time, but sometimes they do not.

0-1 step click - probable issue with load RC network. I have this issue when I put VxD in front of gainclone, but not when I put it in front of another VxD, for example. You can disable mute function at vol=0 if you cannot weed it out at the source.

49-50 slight jump - this might be slight calibration issue. You can simply disable the last volume step if it bothers you:

else if (vol == VOL_MAX_STEP) {
setLSE_Range(LOW); setRSE_Range(LOW);
setLSH_Range(HIGH); setRSH_Range(HIGH);
setLSE(255); setRSE(255); setLSH(0); setRSH(0);
}
__________________
Custom DIY PCBs, BOM and LDR Firmware:
https://sites.google.com/view/dacgear/
  Reply With Quote
Old 22nd February 2017, 07:33 PM   #717
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
So I have replaced the damaged port expander and Nano (socketed this time) and I'm back online.

Attached is a basic drawing of the control signals and measurement points and what pins in the code they relate to. I have then gone through the 50 steps and mapped the values into a spreadsheet and plotted the results.

Not sure what it tells us fully yet but the bump at the middle and the top are a result of switching ranges. The schematic has also helped understand it a little better too.
Attached Images
File Type: jpg Shunt Series Layout.jpg (135.8 KB, 386 views)
File Type: jpg Resistance Plot.jpg (71.4 KB, 369 views)
Attached Files
File Type: pdf VxD Controller Log.pdf (6.3 KB, 25 views)
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”

Last edited by garym999; 22nd February 2017 at 07:37 PM.
  Reply With Quote
Old 23rd February 2017, 09:46 AM   #718
zdr is offline zdr  Belgium
diyAudio Member
 
zdr's Avatar
 
Join Date: Nov 2005
Location: Brussels, Beograd
Here are some debugs while rotating encoder around range switching point:

Volume:31
RSH voltage:4057.20mV RSH current:0.12mA dataR:3323 RSHrange:1

Volume:30
RSH voltage:259.70mV RSH current:0.12mA dataR:32979 RSHrange:0

Volume:31
RSH voltage:4042.50mV RSH current:0.11mA dataR:3323 RSHrange:1

Volume:30
RSH voltage:274.40mV RSH current:0.12mA dataR:32979 RSHrange:0

30-31 transition bump I could cancel by delay, but 31-30 transition I could not - because falling edge and raising edge of two opposing events are not with the same slope. I cannot influence the shape of setRSH_range because it's done by switching pinmode from INPUT to OUTPUT LOW. But maybe I can do something about the other edge driven by PWM (dataR) so that slopes can cancel each other better.
__________________
Custom DIY PCBs, BOM and LDR Firmware:
https://sites.google.com/view/dacgear/
  Reply With Quote
Old 23rd February 2017, 11:55 AM   #719
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
My larger 2.42" display turned up today from Hong Kong so I was all excited. Wired it up... nothing. Noticed that all the surface mount components were hand soldered and all over the place. Then found an inductor with its terminals off angle to the pads and so it wasn't making connection. The componets must have been glued on first. Wired on some links and bingo it is all up and running!

If you look at the 26/27 crossover point on my table there does not seem to be a dramatic change in any of the resistances at least not out of step with the ones either side so as you say it must all be in the transition.

It is this same transition on the Series side at 49-50 that is responsible for the click there also. Of course that is easy to code out and in most instances will never be an issue anyway.
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”
  Reply With Quote
Old 23rd February 2017, 12:16 PM   #720
garym999 is offline garym999  United Kingdom
diyAudio Member
 
Join Date: Jan 2017
Location: Oxfordshire
So I'm now benching it with a 2V 1Khz square wave on my scope so I can see what is happening a little better.

On the 26>27 transition there is a +160mV spike and the opposite on the 27>26 transition. It might be even larger cos of the scope response.
Attached Images
File Type: jpg Bump.jpg (298.2 KB, 346 views)
__________________
__________________________________________________ ___________________________________
“There are only 10 types of people in the world: those who understand binary and those who don’t.”
  Reply With Quote

Reply


Arduino based LDR volume and source selection controllerHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Modified PGA2311 kit with Arduino for volume control and input selection cjkpkg Analog Line Level 29 17th September 2019 12:04 PM
Passive Preamp: Arduino based, remote control, Relay R2R, input selection maxw Analog Line Level 104 18th July 2019 10:13 AM
LDR Based Input Selection udailey Analog Line Level 27 8th November 2018 04:37 PM
Source select and passive volume for microcontroller-based preamp? vputz Analog Line Level 3 21st July 2012 11:51 AM
WTB: LDR-based volume control / pre jdubs Swap Meet 7 2nd December 2010 02:50 AM


New To Site? Need Help?

All times are GMT. The time now is 09:26 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 14.29%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright ©1999-2020 diyAudio
Wiki