I have a Arduino connected to a proximitor sensor and LCD screen. Currently with it being powered through USB everything works fine.
I have the code reading analog input voltage which i have coming from the sensor and through a voltage divider. The code then converts the reading back to the original sensor voltage along with other things that are irrelevant.
My project needs to be powered through the external because this devise needs to be portable.
I am using the same 24-28V power supply, that is being used to power the Proximotor sensor, for the external power source ( using a voltage regulator to bring down to around 10V) before connecting to the power jack.
The moment I plug the jack in the LCD analog reading changes from the voltage coming into the input pin to the voltage being supplied to the external power source ( This happens with the USB plugged in and without it plugged in)
When i remove the jack the LCD goes back to reading the correct value.
On a side note when the external jack is plugged in the prox sensor no longer changes the voltage value with respect to its position. The value is always at the external power voltage.
I am confident i have my Voltage regulator is wired corrected because i am getting 10.12 volts with a voltmeter when connected to Vout and GND.
It seems to me that is has to do with the Analog Reference or that the arduino switches something when the external jack is being used.
The Arduino does not switch something.
The power circuit supplies the power to the microcontroller and it runs without knowing where the power came from.
The value of analogRead() is however only valid if the Arduino 5V is 5.0V and not 4.5V.
You could lower the voltage regulator to 7.5V and use that for the Arduino DC plug.
To solve this, we need to know more.
Which Arduino board ?
What voltage is the 5V pin with USB power and external power ?
Can you measure the AC voltage of the your external power supply. If the AC is higher that 2V under load, it is broken.
Can you upload a photo of your Arduino with the wiring ?
Can you make a small minimal sketch that shows the problem ?
Can you upload your sketch between code tags ?
What is connect to the Arduino ? The backlight of the lcd requires some current. Anything else ?
Can you put your finger on your voltage regulator and the voltage regulator on the Arduino board. Anything getting hot ?
Do you use a breadboard for the voltage divider ? A breadboard have sometimes bad contacts.
I have figured out the issue but i do not know how to fix it.
As i stated before when i used the USB for power everything works completely fine. I have proven this by connected and disconnecting the External Power Jack.
When I plug the External in my code and LCD also still work completely fine, Except my voltage value that is displayed changes.
After looking into it more i have discovered that the value it is changing to is exactly 5V. i took a voltmeter and connected to the leads right after my voltage divider coming from the prox sensor. When i dont have the external plugged in, the divider is reading the voltage value i want (dependent on the position of prox probe) but when i plug the external jack in the voltage coming from the divider jumps to just over 5 volts.
So i believe this is why my analogRead is reading its max voltage of 5.
I have declared it is not an issue with the Arduino or my connections but of that of my Power supply and Prox Transducer. It seems i cannot have 2 devices being powered by the supply even though there are 2 (+) and 2 (-) at the output.
The moment i connect the External Jack to the arduino ( from power supply through voltage regulator) my prox transducers goes from reading the correct voltage to the max 25 volts the power supply is set to. (voltmeter connected to the prox transducer itself)
Not sure how much help you could provide
I really dont want to have to use a seperate battery to power the Arduino when i have a power supply right there powering my proximitor sensor.
Is there anyway i can tap into the power supply without effecting the proximotor sensor.
You might have a broken ground or missing ground... Make sure the proximity sensor's ground is connected to the Arduino Ground. Try turning the computer off with the USB plugged-in (and grounded), but not powered.
You state the reading is changing but not by how much, so it's hard to understand how much accuracy variations you are seeing. I suspect the problem is just one of having the arduino reference voltage changing when using USB voltage Vs the on-board +5vdc regulator voltage, as these two voltage sources will never be exactly the same as both are subject to specific tolerance variation. The default reference voltage used by the analogRead() function is from the Avcc pin which is the same as the boards Vcc voltage which is being powered either from the USB cable from your PC or from the on-board voltage regulator if using external power. So measure your shield's 5V pin using both USB and external power and post what your voltmeter says.
If the best accuracy possible is required there are several methods of obtaining a more stable reference voltage as some expense but then again if accuracy is a paramount importance then using an external higher quality I2C or SPI ADC chip is a better solution. The arduino 10 bit analog converter is a very handy and useful feature but should never be confused with instrumentation quality ADC capabilities.
Here is a nice ADC module that will give better results then the AVR's build in ADC ever will.
Lefty
I stated above that it isnt a change in readings. i stated that no matter the the position of my prox prob the voltage i am reading is always 5 volts when using the external DC jack.
the reading im getting is actually 15.199v but that is because i have a conversion factor in my code of .32864.
so 15.199 * .32864 = 4.994v
To finding the missing ground or ground disconnection. the moment i connect the ground from my voltage regulator to the arduino that is when i read that 5 volts. at this point i also use a volt meter and checked the voltage out of the sensor and i was getting 25 volts which is what my power supply is putting out.
i did a test by disconnecting the dc jack (USB power is plugged in) and i connected a ground wire from my voltage regulator to the ground connected to the arduino and the same thing happens. the moment i disconnect that ground the device goes back reading the prox sensor.
I think we need to see a schematic....
The power suppy ground, the Arduino ground, and the sensor ground all should be connected together. All of the voltages & signals need a common "reference point". (Of course, the voltage regulator needs to share that common ground too.) That might not have anything to do with your problem, but it's something to check. If connecting the grounds causes a problem, something is wired wrong.
To finding the missing ground or ground disconnection. the moment i connect the ground from my voltage regulator to the arduino that is when i read that 5 volts. at this point i also use a volt meter and checked the voltage out of the sensor and i was getting 25 volts which is what my power supply is putting out.
That's all very confusing... 5 volts where? Out of the sensor? Out of the voltage divider? There are protection diodes on the Arduino inputs and if you have a series current-limiting resistor (or voltage divider), that should clip/limit the analog input voltage to just over 5V (which might not be give you the calculated/expected output from your voltage divider).
the moment i disconnect that ground the device goes back reading the prox sensor.
So it reads the sensor correctly with the ground disconnected?
i am in the process of making a schematic for everyone.
while doing this i have been researching and came across this link.
http://forums.adafruit.com/viewtopic.php?f=24&t=22652
does this mean i cant power the arduino externally and record the changing voltage (from prox sensor) at the same time (commonly ground).
it seems that the voltage i am recording when the external is being used is (5 volts) the Reference voltage. i could be wrong
I have attached the schematic.
I want to state that i am only a Mechanical engineering Intern and have never messed with this stuff prior to this project.
So the problem could be something simple that i could be missing.
Once again when i remove the Voltage regulator all together and power the Arduino via the USB everything works fine.
Works fine as in as i move the probe closer to a surface the voltage goes from 25v to an approaching 0 v (never gets to zero because of there is no perfect surface).
the divider changes the range from 5 to 0 (not exact). and then the code in the adruino factors it back up to the 0 to 25 range to be displayed on the LCD.
Like i said i have this working with USB power.
The moment i plug the DC jack into the Arduino the voltage i am reading before the voltage divider is 25v the same voltage coming out of the power supply.
No matter how far i move the probe away from the surface it doesnt change from 25v.
Schematic Arduino.tif (79.3 KB)
I looked up the data sheet on my power supply and even though there is 2 postive outputs and 2 negative outputs the data sheet says it only has One output.
Is that why i am seeing this problem when i have the grounds connected to the Arduinos common ground?
fradan:
I looked up the data sheet on my power supply and even though there is 2 postive outputs and 2 negative outputs the data sheet says it only has One output.
Is that why i am seeing this problem when i have the grounds connected to the Arduinos common ground?
Yes, I'm pretty sure that is the root of your problem, that you require two "isolated" external voltage sources from your external power supply, one for the arduino source, and one for the sensor power source which uses the opposite polarity then the arduino. Also the method of wiring the output of the sensor is rather strange but if it works when you have the arduino powered by USB then it must be converting the negative voltage powered sensor such that the arduino ADC is still 'seeing' a positive variable analog voltage that it can correctly measure.
Lefty
With that being said, instead of purchasing a larger dual output power supply that wont fit inside my device box could i run a second supply off of the AC power to run the arduino?
This power supply converts to 9VDC and is small enough to fit where my voltage regulator is. (wouldn't need it anymore)
Link is to the power supply: http://www.digikey.com/product-detail/en/VSK-S1-9U/102-2594-ND/3465374
i have attached the schematic of what the change would be.
Schematic Arduino.tif (356 KB)
fradan:
With that being said, instead of purchasing a larger dual output power supply that wont fit inside my device box could i run a second supply off of the AC power to run the arduino?Yes
This power supply converts to 9VDC and is small enough to fit where my voltage regulator is. (wouldn't need it anymore)Yes
Link is to the power supply: VSK-S1-9U CUI Inc. | Power Supplies - Board Mount | DigiKeyi have attached the schematic of what the change would be.
Everything works now.
Thanks for all the help!!1
retrolefty:
If the best accuracy possible is required there are several methods of obtaining a more stable reference voltage as some expense but then again if accuracy is a paramount importance then using an external higher quality I2C or SPI ADC chip is a better solution. The arduino 10 bit analog converter is a very handy and useful feature but should never be confused with instrumentation quality ADC capabilities.Here is a nice ADC module that will give better results then the AVR's build in ADC ever will.
Lefty
Lefty,
I have been looking at this chip to use as an external ADC:
In your opinion, would it be in the same ballpark as the ADS1105 that is found on that Adafruit breakout?
Thanks!
Looks like a fine ADC chip, with a faster sampling and using SPI interface so maybe better then the TI used in the adafruit shield. Of course the adafruit is chip + shield + library support so apples and oranges.
Ok thanks Lefty. I appreciate the feedback.
In my case this is a custom board, so I don't want/need a breakout. And I'm a software type, so writing my own stuff is no biggie. If I get time I'll create a library for this chip that others can use too.
A rather extensive Google search didn't yield an Eagle library that contained this Maxim 11628 unfortunately. I finally found something that seemed workable via the Maxim website, ran that through UltraLibrarian, which generated an unusable file to import into Eagle. Therefore I hand edited the file to correct the issue and finally got what I needed. Then once into Eagle, I edited the imported symbol to make it more real estate friendly on the schematic. Anyway, the point being that those types of searches for Eagle libraries can be frustrating. So in the interest of sharing, I am attaching the library that I created for the Max11628.
Thanks again Lefty.
max11628.lbr (30.6 KB)
@fradan
I am having the same problem now. How did you fix it? I tried 2 different power supplies and both give me the same weird results.
I even tried setting my reference voltage to a constant 5 votls from the power supply and still it does the same thing.