[Dprglist] Light Sensors, Moth/Anti-Moth Behaviours, and PID steering

Doug Paradis paradug at gmail.com
Thu Feb 11 22:08:26 PST 2021


Murray,
     I should have pointed out in the last message that the motors are not
under P speed control in the code segment I included. The code was from an
example where I was training people who had never built robots and I was
trying to keep it simple.

Regards,
Doug P.

On Fri, Feb 12, 2021 at 12:02 AM Doug Paradis <paradug at gmail.com> wrote:

> Murray,
>      CdS LVR sensors have a light sensitivity similar to the human eye.
> That is why they were often used in camera light meters in the past. If you
> get quality cells the match isn't too bad. However, because of price I
> often buy a quantity of 10 to 30 cells from China on ebay ( about $2 for
> batch) and select 2 that are close. They do not need to be exact because
> you can correct mismatches in the software. The shape of the response
> curves between cells of the same type are generally similar (unless you are
> getting failed parts). Response times of small CdS cells are generally 20
> ms when decreasing value and 30 ms when increasing value. Even 70 ms
> response time is adequate for a moth / cockroach robot, since you do not
> need the sensors to be at steady state.  The interesting light intensity
> value range for this type of robot is usually 4 to 400 Lux (Dark limit of
> civil Twilight under clear sky to well-lit office area). Published CdS LVR
> response curves are typically measured over a range of 1 to 100 Lux. Again
> this is adequate. Brighter than 400 Lux usually isn't too interesting.  As
> you stated the usable light intensity range is about 10-600 Lux.
>
>    I use a proportional speed value based on the absolute difference
> between the sensors. Like this:
>
> case LVR_L:                        // Turn Left
> // left mtr slow fwd, right mtr fwd
> set_motors(100 , (100 + pro_LVR_spd));
> delay(15);
> break;
> case LVR_R:                        // Turn Right
> // left mtr fwd, right mtr slow forward
> set_motors((100 + pro_LVR_spd), 100 );
> delay(15);
> break;
>
> Where pro_LVR_spd is determined:by something like::
>
> uint16_t proportional_response_LVR (float KP, uint16_t L_LVR_value,
> uint16_t R_LVR_value)
> {
>   uint16_t response = KP * abs(L_LVR_value - R_LVR_value);
>
>   if (response > 100) {    // set max value
>     response = 100;
>   }
>
>   return (response);
>
> }
>
>
> Moth / Cockroach is one of the Braitenburg vehicles.
>
> Regards,
> Doug P.
>
> On Thu, Feb 11, 2021 at 10:49 PM Murray Altheim <murray18 at altheim.com>
> wrote:
>
>> On 12/02/21 4:17 pm, Doug Paradis wrote:
>> > Murray,
>> > Moth / Anti-Moth (i.e., Cockroach) behavior robots are really fun
>> > for children and are very simple to make. All you need for sensors
>> > are 2 CdS light sensors and 2 A/D pins. The Build More Robot tutorial
>> > series had a session devoted to them. They were also demonstrated
>> > using the Tiny Wander DPRG club robot (see Make Magazine vol 29)
>> > which used a Attiny13 8 pin processor.
>>
>> Hi Doug,
>>
>> As you suggest, it'll be fun seeing how the robot reacts to the varying
>> light levels in my house. Thanks for the link to the video, looks like a
>> CdS photocell robot works just fine. I'm making a more-than-necessarily-
>> complicated version of the Moth. Seems a lot of what I do is more than
>> necessarily complicated. Not sure why that is... I just want life to be
>> simple. (ha!)
>>
>> I'm also interested in having the bias between a left and right sensor
>> possibly provide a proportional bias steering the robot towards or away
>> from the light. It might be possible to do something similar with a
>> CdS cell, but I understand that photocells work within a more limited
>> light range and aren't very consistent between individual units, though
>> as the video suggests, maybe that doesn't matter so much. On the other
>> hand, being able to measure somewhere between 0 and 65K+ lux (using a
>> BH1750[1]) or 3 to 55K lux with a logarithmic scale using a GA1A12S202
>> sounds pretty interesting. And response times are more around 10-20ms.
>>
>> I was trying to find the specs on a typical CdS cell and it seems their
>> usable range is more like 10-600 lux and have response times of
>> somewhere between 50-70ms. The specs (e.g, [2]) usually just say
>> something like "dark resistance" but don't provide much help about
>> performance in dark rooms, i.e., provide a helpful notion of the curve
>> of their response.
>>
>> This could of course even be done without a microcontroller or some fancy
>> new sensor, but we gotta advance the science! :-)
>>
>> Cheers,
>>
>> Murray
>>
>> [1] https://www.mouser.com/datasheet/2/348/bh1750fvi-e-186247.pdf
>> [2]
>> https://www.tme.eu/Document/0b7aec6d26675b47f9e54d893cd4521b/PGM5506.pdf
>>
>> ...........................................................................
>> Murray Altheim <murray18 at altheim dot com>                       = =
>> ===
>> http://www.altheim.com/murray/                                     ===
>> ===
>>                                                                     = =
>> ===
>>      In the evening
>>      The rice leaves in the garden
>>      Rustle in the autumn wind
>>      That blows through my reed hut.
>>             -- Minamoto no Tsunenobu
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20210212/8c1b3742/attachment-0001.html>


More information about the DPRGlist mailing list