I'm trying to build a midi controller that takes the input from a photoresistor and a reed switch anemometer and outputs midi signal.

I've constructed the circuit as in the diagram below but when I test the inputs I receive only random numbers from analog input 3. I get a clear signal on A5.

I'm confused as to what's going on. I've seen other solutions to this problem mention the circuit not being grounded properly but as far as I can see I have the correct grounding.

enter image description here

  • 1
    220Ω is incredibly small for your inputs. 10K is better. Especially for the LDR.
    – Majenko
    Dec 17, 2016 at 19:28
  • Could you post a picture of your setup? The schematic looks fine, so there might be an error in your wiring, maybe.
    – Gerben
    Dec 17, 2016 at 19:47
  • Often problems are code, hardware or both. Can you please post your code? (Edit your question to do that. Indent it with Ctrl+K so it looks nice).
    – Nick Gammon
    Dec 18, 2016 at 5:09
  • Thanks for the input guys. Originally I was finding that my circuit, which i had soldered myself, was not working. I rebuilt it on a bread board and it is working fine now, must have been an issue with my soldering!
    – Tom
    Dec 20, 2016 at 14:15

1 Answer 1


Random numbers usually mean that the pin is floating (i.e. not touching anything)

You need to check your connections to A3.

Try this:

  • Remove the LDR and R6. Check their resistance using multimeter. (To see if they are not burnt etc.)
  • Connect R6 to its place. You should get 0 V (0) because R6 is connected to GND.
  • Remove R6 and put it in place of LDR. Now, you should be seeing 5V (1024) on A3.
  • After you complete this for R6, try it with using LDR only. You should see same results (Make sure LDR has some light on it to lower its resistance)
  • Put everything back in place. You should not be seeing random values because now everything is properly connected.

If you are still seeing random values, then that LDR may be disfunctional. Get another one.

Oh and one more thing, make sure LDR illumination does not change while you're getting readings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.