-1

I'm building a light-triggered sound puzzle for my kids, and I have seven pieces. A little bit like this toy:

My plan was to plug 7 photoresistors to ADC pins on my Raspberry Pi Pico, but actually, there are only 3 ADC pins, right?

Someone advised me to just plug them in regular digital pins, and then just make sure the signal is simply thresholded to yield a High/Low kind of switch.

I'm a total newbie and I'm not sure what components I need to couple to the photoresistor to convert the analog signal to high/low digital one.

13
  • If you want an on/off don't use photoresistors
    – Milliways
    Commented May 18, 2023 at 11:45
  • @Milliways, can you point me to another direction, then, please?
    – Myoch
    Commented May 18, 2023 at 11:59
  • This is an XY problem You have assumed a solution to a problem (you haven't described) and want us to tell you how. What is wrong with a switch?
    – Milliways
    Commented May 18, 2023 at 12:01
  • See Tour to see how this site works and How do I ask a good question?
    – Milliways
    Commented May 18, 2023 at 12:02
  • Well, the link tells you what I am trying to build: a puzzle that generates sound when the right piece is on the right spot. So maybe I haven't described the component available at home, but it's unfair to say that the problem is not stated, as this is the very first line
    – Myoch
    Commented May 18, 2023 at 12:05

2 Answers 2

0

Make multiple voltage dividers that all use the same lower resistor.

Pull one GPIO pin high.

Set the others to input, which effectively disconnects them.

Read the voltage.

Repeat for each LDR (light dependent resistor)

      GP1     GP2     GP3
       |       |       |
      LDR1    LDR2    LDR3
       |       |       |
       +--------------------- analog input
       |
       R
       |
       |
      GND

0

I am assuming the LDR is normally illuminated and you require to detect when the light is obscured.

An LDR is not the ideal device for an ON/OFF circuit and is normally used in applications requiring a level depending on illumination but can be used if your application is either fully lighted or dark.

The resistance of a photoresistor (LDR) decreases with increasing incident light intensity.

Ideally you need to determine the LDR resistance when illuminated then make a voltage divider to produce < 1.2V which is the nominal GPIO threshold (actual 0.8V - 2.2V).

Most LDR will have very high resistance if totally in the dark so the actual resistance when illuminated is not critical.

I would try the following which should result in a voltage close to 3.3V when dark.
You may need to vary the resistance to ensure the voltage is < 0.8V when illuminated to ensure reliable operation.

schematic

simulate this circuit – Schematic created using CircuitLab

Your Answer

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

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