Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

analog input with GL5528 photoresistor

photoresistor GL5528

  • Please log in to reply
1 reply to this topic

#1 Rossi



  • Members
  • PipPip
  • 10 posts

Posted 08 June 2017 - 11:03 AM

Hi Sir,

I'm working with GL5528 photoresistor connected with analog channel.

The voltage value is floating.

How can I stabilize the voltage?







#2 Arron Chapman

Arron Chapman

    Advanced Member

  • Members
  • PipPipPip
  • 289 posts
  • LocationOregon, USA

Posted 14 June 2017 - 02:33 AM



This is a common situation with analog devices and there may be several factors involved.


For example, if there is any ripple in your light source this will be reflected in the output of your sensor.  In the US it's quite common to find 60hz (50hz in most of EU/AU) noise in just about everything because this is the frequency the AC in our houses runs at.  In many cases, one will find a 60hz oscillation in optical sensors because the lights will flicker at this frequency.  Additionally, it's possible that there are fluctuations in the power supply of your Netduino, which can be induced by the same AC signal.


I'm going to assume your circuit looks a bit like this;



There are 2 realistic ways of solving this problem; First is the electrical solution!  You can add some capacitance to the output line to help filter out the noise. What type and size of capacitor won't matter a huge amount for this purpose, I'd pick something in the 100pf range, though you might just experiment a bit to see what gets you the best results. Wiring it up is rather easy, you'll just put it in between your sensor's output and GND.



The second option is the less fun option but you can fix this in software as well!  The easiest way to do this would be to just keep a local average of the input, using that instead of the raw value.

for (int i = 0; i < 100; i++)
	localTotal += sensorInput.ReadRaw();
localAvg = localTotal / 100;

This will give you an average over the last ~1 second.



Both of the solutions have 1 major consequence which is that they reduce the responsiveness of your sensor, as each solution increases the amount of time required to output the new value.  The exact extent of this delay depends on how you choose your capacitor, or how tightly you run the averaging loop.

When you talk EE use small words, I'm just a Software Developer :)
My Blog/Site and Everything Else

If my post helped you please consider pressing the "Like This" button in the bottom right-hand corner.


Oh my. So many things, so little money!!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.