October 2, 2015 at 11:22 am #2726
Completed: Crumble detects movement and switches Neo Pixel white lights on for 1.5 minutes before switching off and then looping.
This all works (too) perfectly – the lights come on regardless of the existing light level.
I have a two pin light level sensor from a camjam.me edukit – open in new window. and wondering if i can simply connect one pin to + and the other to an analogue input? – could it be that simple?
I know I could ‘give it a go’ – but experience and wisdom says otherwise!
Thoughts/Comments welcome please.October 2, 2015 at 12:10 pm #2727
It looks like the light sensor is a standard LDR, so yes you can connect the LDR to + and an input 🙂
If you create the program in the attached screenshot and ensure the Variable tab is open, you should be able to monitor the analogue value in realtime – next to the variable ‘t’ in the sidebar, you should see a number instead of a question mark.
Hope this helps,
Attachments:You must be logged in to view attached files.October 2, 2015 at 1:13 pm #2729
Many thanks, seems 0=Direct Sunlight and 1=Room (day) – will be good to see if this changes to 2 or 3 later…. Many thanks for the quick response – appreciated.October 2, 2015 at 4:09 pm #2730
Mmmm… That doesn’t sound quite right. I’d expect roughly >200 in daylight and <100 in low light. Was the battery connected when you took these readings?
JosephOctober 2, 2015 at 5:03 pm #2731
If i disconnect the PIR and the Neo Pixel ring I get a good reading from the LDR – my assumption is that I can’t run the PIR, Neo Pixel and LDR at the same time… Will do some more playing… I’m powering the crumble from a port on my (Official?) RaspberryPI hubOctober 3, 2015 at 8:07 pm #2733winkleinkParticipant
I believe you need to use a voltage divider for the LDR to give an analogue input. The following link gives more details.
As the Raspberry Pi doesn’t have analogue inputs the CamJam kit uses time to charge as the measure of light.
An LDR is just a resistor that changes it’s resistance depending on the amount of light that hits it. You cannot get a value from it by just connecting it to 5V.
I’d suspect your analogue pin is floating or the value is dependant on the internal resistance of the Crumble.October 4, 2015 at 10:23 pm #2734
Yes, normally you do need a voltage divider to use an LDR directly with an analogue input, however, the Crumble has 100k pulldown resistors on each of ABC and D, which form the ‘bottom’ part of the divider. Although, depending on the LDR, you might get better results with a 10k resistor, for example.
I can’t think of a reason why you couldn’t use an LDR, Neo pixel ring and PIR sensor at the same time. Unless they are sharing pins, or there’s a dreaded bug!
Powering from the Raspberry Pi hub should be fine.
If you wanted to send me the program, I wouldn’t mind taking a look at it.
All the best,
- You must be logged in to reply to this topic.