Brazil
Asked — Edited

Ldr Sensor

Hi friendS! How do I connect a LDR Sensor to EZ-B? The idea is make the robot's lights and LEDs brighter when in a higt light environment... And... Naturally, vice-versa... Thanks for the help!


ARC Pro

Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

United Kingdom
#1  

It depends on the LDR. If you are thinking of using a simple LDR such as the 200k VT90N1 it should be pretty simple. You will need to build a small circuit which connects to one of the ADC ports.

As mentioned, I'm trying to get everyone to think more and work their own problems out with guidance so I wont post the circuit (yet) but will explain what needs to happen... Well that and I don't have time to draw a schematic.

The ADC ports pick up a voltage on the signal between 0v and +5v. This is read in ARC with the ADC controls or using script command GetADC(). It will return a number between 0 and 255 depending on the voltage at the signal pin.

There are +5v and Ground pins on the ADC ports too. Use one of these to provide the 5v to the circuit. You will need to make a point on the circuit where the LDR will reduce the voltage when measured. This is the point that needs to go to the signal on the ADC port.

What will happen, the LDR will change resistance, this will cause a drop or rise in voltage, the ADC port can be read and the value checked and trigger events, enable lights etc.

Anyone else fancy having a bash at the schematic? If nobody else can help and/or if you can't work it out I will post a schematic, I'm not that mean:D But give it a go, see if you can figure it out, you'll have more fun and feel you have achieved more if you can work it out yourself.

United Kingdom
#2  

A small hint to help things along... This topic may be useful.

United Kingdom
#3  

Seriously, how hard is it for me not to give the answer already?!

This is open to anyone to have a try at.

There are 2 methods I can think of from the top of my head.

The first enables dimming ability based on the lighting level. The other is a simple on/off based on the lighting level. Is anyone going to have a go at solving either (or both)?

This is a perfect opportunity to use 123d Circuits too:)

United Kingdom
#4  

I guess nobody else wanted to help...

One method of doing this, for a variable light level in ARC would be to build a voltage divider and use the LDR in place of one of the dividing resistors, then the light level changes the resistance changes, the division factor of the voltage divider changes and the voltage feeding in to the ADC port's signal will vary. This can then be read in ARC through the GetADC() command and your scripts can act on it as required.

The other method would use similar as the first however the LDR would be on the base side of an NPN transistor. When the resistance of the LDR changes it will vary the voltage on the transistor. Only when the voltage is high enough will the transistor allow current to flow from the collector to the emitter, therefore completing the circuit and that can be fed in to the digital port's signal pin or an analogue ports signal pin. ARC can then read this and your scripts can act as required.

Example circuit (very rough and crude, use as an idea only)

User-inserted image