Asked — Edited

How To Ambient Light Sensor For Ezb To Trigger Ir Lights

Ok so I need to make ir buy a light sensor that I can place ontop of my bot through a drilled hole on Omnibots head or neck area. I will have about 25-50 5mm forward facing ir LEDs and 25-50 inside omnibots eye sockets so it illuminates the most where omnibot is looking. They will all not even draw a amp because LEDs are so low power. Any ideas of how to switch on the LEDs? I would like for it to switch the IR on when it hits a certain level of darkness. I believe my IR LEDs run on 2.5v and draw .02A thanks


ARC Pro

Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

#1  

THERE 2 WAYS one is use a photocell with resistor in series ,photo cell to gnd and on resistor other end v+ like a voltage divider ,where the resistor and photocell comes together is the output then use a simple comparator circuit to turn on a transistor then switch on led

other way is get a PHIDGETS light sensor and output goes to comparator circuit

phidgets light sensor

to set the trip point use a pot,transistor needed to drive led is pnp lke 2n2222,mostly any will work will need a base resistor from output of comparator to base of transistor ,i use like 4.7k

#2  

Ok , not sure.how to apply this. Are you suggesting this run to.USB adv then a output triggers a relay to power on the LEDs? I may have half a amp worth of whites / ir

#3  

you use a photocell board or photocell divider to op amp set up as comparator way it works you have a photocell putting analog voltage when it dark and set point on comparator using voltage divider and when light hits the photo cell voltage drops below the set point you set and turns on a transistor switch that turns on a led lm311 comparator circuits

you use LM311 single comparator chip AND 5 VOLTS supply single ended if you find a photocell any type and find out the dark resistance and then get a resistor to match the value set point with 2.5 volts ,half of voltage supply ,then get a pot of twice the value of the photcell to set above or below 2.5 volt threshold if you need help on circuit or values i can help you

on current driving of leds a mosfet will be the best answer,can drive more then 1 amp and low current drive from comparator

United Kingdom
#4  

@ jstarne1 Or use one of these Mini Photo Cell simple and very cheap

Then feed the output into an EZB ADC port and add a script to switch on your IR lamps via EZ B digital port

Also do you really need that many IR LED's I would try a few experiments 1st and see what works with your camera

#5  

that can also work easy too,still need a mosfet as a led driver,better then using a relay any cheap photocell will work,goldmine-elect has some very very cheap

on using A/D port on EZ board might have to adjust the values alot ? sometime other light sources will trigger it and turn on the light,but depends on what you want to use the light detecting circuit for at work we make LUX meter ,witch uses a photo cell design LUX is the illuminance measure of light in units LX, higher the LX brighter the room is

#6  

Why not drive the LED direct from the EZB that is what I am doing....works fine...it does take up another port on the EZB however.

v/r

Kevin

#7  

kevin he has 2 problems one is it needs about .5 amp ,most outputs can only sink about 10 to 20 ma and 25 of them are .5 amps ,so the outputs would go bad

second wants to turn them on when near dark,so photo cell is only way to go,now to fine tune the photo cell on EZ-BOARD can use a pot or use a meter and measure the output voltage at the level you want lights to come on and set that voltage in EZ-ROBOT script and use mosfet to drive all of the leds,can use a relay ,like reed relay but still need a transistor to turn on the relay(i have many can sell very very cheap)

on making a comparator circuit witch is easy to make,dont need to make any scripts,or tie up analog port and is adjustable

some info about using relays and mosfets most relays use high current on coil,not as fast switching,needs switching transistor reed relays fast switching low current coil small size,needs switching transistor mosfets very small size ,very low current drive ,low rds on ,sometimes dont need a switching transistor like relays need, also higher power transistors will work ,might need a switching transistor

#8  

@robotmaker,

I must be missing something. You can easily drive multiple LEDs off a single ezb port (much less than .5 amps). A simple script can be written to turn them on when the ADC port from the photocell registers above/below a certain value. If the photo cell power is an issue, you can power itl from a different source if needed so long as you have a common ground. I use an analog accelerometer to turn on/off motors depending on tilt of the bots waist. Works great. That circuit could just as easy be a photocell and LEDs.

Comparator circuit would surely work but then you are hard wired. I would like control to be able to over ride it, if desired, and also use the photo-cell information to trigger other events.

v/r

Kevin

#9  

KEVIN look at the manual on EZB it says can only source or sink 25 ma,thats about 1 led,there are low current leds 1 ma ,what you might be looking at is scanning leds then you are only driving one led at a time its near the bottom of manual under specs for max current source or sink 25ma

on comparator circuit there is a pin can be used to over-ride it,chip is 8 pin and comparator circuit can drive EZB digital input and then drive a mosfet or relay ,so you have both over ride and trigger other events set point on photocell will be hard to set without a pot,will need a meter and measure it,or in the photocell voltage divider add a pot on top of the divider string or bottom depending on photocell circuit for EZB

photocell power is very low current ,its near 10k for most of them its near .00025 amp or 250 ua

also when using led you need to set the current of each led ,about 470 ohms with a 5 volt source. ,7.4 volt source use near 370 ohms,but i would use a 5 volt source or source with regulator another problem you need to look at is total current for servo's,motors,EZB,and anything else you add ,for to stay near the limits of each regulator,also stay well under less heat

#10  

@robotmaker

I am driving 2 lilypad LEDs direct with EZB digital I/O with no problems....I am not quite sure what DJ means about the 25mA 'High current sink' on the Digital I/O as servos draw much more than that (micro servos draw like 200mA) when operating.

I am also driving a larson scanner LED kit directly (at the same time) off an EZB I/O port with no issues whatsoever where up to 4 LEDs are lit at a time.

btw the Larson scanner is an awesome augentation to any bot....highly recommended!

Larson Scanner

#11  

servos are not driven from a port only pwm signal is,they use 5 volt supply to drive servo power thats why DJ has a seperate power supply can be hook up

lily pads leds are 2 ma leds so can drive upto 12 of them it you look at any microcontroller data sheet it shows max current drive is 25 ma ,thats one led.like the arduino same think if you asked the same question on thier website site you will get the same answer 25 ma total current drive at 500 ma at 2.5 volts meens it need a high power transistor to drive it ,alot more then what pic or arduino uses most people source a led ,meens cathode to ground ,5 volts out using 470 ohm to set the current of led using at 20ma logic 1 turns on led logic 0 turns off

on the larson scanner circuit is different it uses another chip to drive the leds and it scans the leds,so current is little lower,plus i see they use I/O FOR EACH LED total of 9 pins on chip also for 500 ma you need a heatsink or regulator will get hot,i dont think any micro has a heatsink inside,thats why can handle 500 ma needed for 25 leds,now can use 12 1 ma leds from HP AND 2 I/O ports or 25 I/O Ports driving one 20 LED EACH

took some time but i found the data sheet on cpu that EZB is using 18f4685 it says the same thing for digital I/O PIN High-Current Sink/source 25 mA/25 mA ,witch meens total current drive on any digital pin

check the arduino lilypad total source/sink is 40 ma max,so can drive two 20 ma leds

#12  

That makes sense. I was mixing up the I/O current with the current available on the Vcc pin which is alot higher. I will say the lilypads are great LEDs..very bright. Very good if you are trying to save power.....

#13  

I would say its best to just use the ezb to trigger a low power relay. Like a reed relay from radioshack. This way.I can put a switch on the back of my bot so I can manually turn off the led lighting as it could be annoying at certain times. So is a comparitor circuit the way to do this? Agian I only want to use ezb as trigger I don't want to power any accessories with it.

#14  

it depends if you want to want to make a extra script for it and measure the phot cell analog output for darkness you have for it to come on using analog port,other is making a comparator circuit with parts from radio shack board and parts fairly cheap,then add a pot to adjust it and use a simple digital input script to trigger the digital output relay,reed switch is fairly good way to go,will need pnp transistor to turn it on from the digital port mosfet is better and about the same price of reed relay plus transistor

keep in mind will need 25 resistors for 25 leds. for 20 ma at 5 volts supply 470 ohms

#15  

Larson scanner would be cool if it only came on when talking. Just like evolver . His was LEDs that would light in the center and go towards right and left edges.when.he spoke.

User-inserted image

#16  

you can use LM3915 circuit for mouth,when sound apply to input the leds move to be like he is talking they sell board complete for it,i think website is canakits

here is is,you need 2 of them led vu meter kit

or 10 led vu kit 1 of them can put in series 10 led vu mter kit

#17  

jstarne1 my friend i have over 100 reed relays i can sell you 2 for $1 plus postage of $1.69 have single pole single throw,and double pole single throw 5 volt coil at 50 ma will need npn transistor for 2 reasons one is 25 ma max on digital output pin and coil takes 50 ma,same as one from radio shack second reason is back emf they call it,when a relay coil turns off and on sends a magnet force that will ruin the output pin,and you dont want to ruin $130 board,plus across the ciol still need any diode cathode to v+ to protect the transistor ,since digital output uses one too if you have problems hook it up let me know ,also from outpin on EZB to base of the transitor you need a base resistor mostly near 4.7k hooking up transistor is easy emmiter to gnd collector to coil and anode of diode on other side of coil you connect 5 volt supply and cathode of diode

i just found this after i did this reply says the same thing i said how to drive a relay from digital pin