photocells get light intensity
-
- Posts: 4
- Joined: Thu Nov 18, 2021 10:58 am
photocells get light intensity
Hello everyone,
I work on a school project, and I need to get the light intensity with a photocell. Do you have any link or tips to help us get started ? I already have the raspberry pi and I know how to paste a code to the pico.
However I didn't find the information I needed on the official pdf. I am using micorpyhton, but I am not opposed to switch to C even though I know very little about it.
Thanks for replying.
I work on a school project, and I need to get the light intensity with a photocell. Do you have any link or tips to help us get started ? I already have the raspberry pi and I know how to paste a code to the pico.
However I didn't find the information I needed on the official pdf. I am using micorpyhton, but I am not opposed to switch to C even though I know very little about it.
Thanks for replying.
- OlivierLenoir
- Posts: 126
- Joined: Fri Dec 13, 2019 7:10 pm
- Location: Picardie, FR
Re: photocells get light intensity
Are you looking for something like that?
Last edited by OlivierLenoir on Fri Nov 19, 2021 3:56 pm, edited 1 time in total.
Olivier Lenoir
https://gitlab.com/olivierlenoir
https://gitlab.com/olivierlenoir
-
- Posts: 4
- Joined: Thu Nov 18, 2021 10:58 am
Re: photocells get light intensity
Yes thanks, but how do I get the photocell's resistance ? Can the pico get the current so I can use Ohm's law ?
Re: photocells get light intensity
The pico can measure the voltage, and from that and the known value of the other resistor you can determine the value of the light cell.
-
- Posts: 4
- Joined: Thu Nov 18, 2021 10:58 am
Re: photocells get light intensity
Thanks a lot, I'll try this as soon as I can.
- OlivierLenoir
- Posts: 126
- Joined: Fri Dec 13, 2019 7:10 pm
- Location: Picardie, FR
Re: photocells get light intensity
Based on proposed schematic, you can read photocells with this code.
Code: Select all
from machine import Pin, ADC
# Set sensors
sensor_a = ADC(Pin(26)) # ADC0
sensor_b = ADC(Pin(27)) # ADC1
sensor_c = ADC(Pin(28)) # ADC2
# Read sensors
# read value, 0-65535 across voltage range 0.0v - 3.3v
sensor_a.read_u16()
sensor_b.read_u16()
sensor_c.read_u16()
Olivier Lenoir
https://gitlab.com/olivierlenoir
https://gitlab.com/olivierlenoir
- OlivierLenoir
- Posts: 126
- Joined: Fri Dec 13, 2019 7:10 pm
- Location: Picardie, FR
Re: photocells get light intensity
An other approach, would consist of using an LED as a light sensor, amplified by a transistor.
Olivier Lenoir
https://gitlab.com/olivierlenoir
https://gitlab.com/olivierlenoir
-
- Posts: 4
- Joined: Thu Nov 18, 2021 10:58 am
Re: photocells get light intensity
Thanks, you saved us much time x)
Last question, I want to apply Millman to get R1 for example, is the current running in this direction ?
And is the current coming from 31 negligible ?
Last question, I want to apply Millman to get R1 for example, is the current running in this direction ?
And is the current coming from 31 negligible ?
- Attachments
-
- SolarTracker_schema_courant.png (94.59 KiB) Viewed 8362 times
- OlivierLenoir
- Posts: 126
- Joined: Fri Dec 13, 2019 7:10 pm
- Location: Picardie, FR
Re: photocells get light intensity
You can consider GP26_A0 as an high impedance, so current iGP26_A0 can be considered as 0A.
Current iR1 = iR2. As R1 depend on light, i = 3.3V / (R1 + R2), so i is not constant.
Example with different value for R2
Current iR1 = iR2. As R1 depend on light, i = 3.3V / (R1 + R2), so i is not constant.
Example with different value for R2
Olivier Lenoir
https://gitlab.com/olivierlenoir
https://gitlab.com/olivierlenoir