A light sensor plugin for an automated chicken coop door?

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
MrStewartsir
Posts: 1
Joined: Tue Oct 26, 2021 11:44 pm

A light sensor plugin for an automated chicken coop door?

Post by MrStewartsir » Tue Oct 26, 2021 11:55 pm

Hi,

I'm trying to find a light sensor that would work well to be plugged in to the micro:bit; rather than using the LED sensor method.
As it's going outside, I'd like to keep the micro:bit enclosed in the coop and run a light sensor up and out, but I can't find any accessories that can plug in just as a light sensor?

Also, if you have any ideas or suggestions for how to go about the process, I'm looking to write a program that senses sunrise and sunset, tells a servo or piston to go up or down to open and close the door, and be connected a trickle charged battery fed into by a solar panel.

I know I could buy a chicken door that'd do all this for me, but I'm a teacher and I'd like to show my students some real world application of coding in action.

Any and all advice welcome

User avatar
karfas
Posts: 193
Joined: Sat Jan 16, 2021 12:53 pm
Location: Vienna, Austria

Re: A light sensor plugin for an automated chicken coop door?

Post by karfas » Sat Oct 30, 2021 8:18 am

You could
  • use a LDR (Light Dependent Resistor) together with a pull up/pull down attached to a GPIO port
  • calculate sunrise and sunset (provided you have some means to maintain the current time)
  • use your solar panel as a sensor (it's most likely day when the panel's voltage reaches a specific threshold)
Regards,

Thomas
A few hours of debugging might save you from minutes of reading the documentation! :D
My repositories: https://github.com/karfas

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: A light sensor plugin for an automated chicken coop door?

Post by scruss » Sat Oct 30, 2021 3:20 pm

Kitronik sell an external light level detector that outputs an analogue voltage that might work for you. Thomas's suggestions are all good, too. Solar panels are extremely good at detecting sunrise, but the output voltage is quite dependent on temperature (the warmer it is, the lower the voltage). Your trickle charge controller may not output a panel voltage in the form that a micro:bit can use, though.

Post Reply