[Dprglist] Light Sensors, Moth/Anti-Moth Behaviours, and PID steering
Doug Paradis
paradug at gmail.com
Thu Feb 11 19:17:24 PST 2021
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.
Regards,
Doug P.
On Thu, Feb 11, 2021 at 5:50 PM Murray Altheim via DPRGlist <
dprglist at lists.dprg.org> wrote:
> Hi,
>
> Among my other side projects is a moth/anti-moth behaviour. Rather than a
> passive sensor I thought to use one that provides a better very-low to
> bright ambient light range. From Pimoroni I ordered a pair of Adafruit
> GA1A12S202 Log-scale Analog Light Sensors, which are cheap and tiny 3-pin
> boards that produce an analog output. They arrived yesterday and I built
> a small holder for them on the front of the robot, wired them up to a pair
> of analog inputs, then began writing a Python support class.
>
> But when I thought to look into more details about the sensor I found out
> that Adafruit have discontinued these sensors because they don't actually
> work so well as described. They intended to replace them with a Vishay
> VEML7700 lux sensor wired up as an I2C device, but sadly the designer never
> thought to provide a way to alter the fixed I2C address, so one can only
> mount a single sensor on a robot without resorting to multiplexing, which
> I'd rather avoid. A real oversight. Nice little board otherwise.
>
> Investigating the VEML7700 it turns out that its support library has some
> serious bugs at higher light levels, such as what one would encounter
> outdoors (!), and that part of the problem may be the sensor itself.
>
> Vishay make an improved sensor called the VEML6070, and Adafruit even make
> a breakout board for it (since the sensor is SMT), but, but, but, they
> again didn't provide for altering the I2C address.
>
> So for now I'll be sticking with the GA1A12S202 since I have two of them
> installed and my robot (for now) is indoors. But since the board has been
> discontinued and apparently isn't good for outdoor use I'm looking for
> alternatives.
>
> Adafruit list 26 different sensor boards (!), but it's unclear which have
> good performance and suitable output across a wide light range, and of the
> 26 many have been discontinued. I'm not sure if a UV sensor would work as
> well for a moth/anti-moth sensor; I'm guessing not so well in a dark room.
> There's a TSL2561 that permits altering the I2C address but has also been
> discontinued. From what I can see, almost all of the I2C light sensor
> boards (e.g., TSL2561) that haven't been discontinued have fixed addresses.
>
> The one exception to this is the BH1750,
>
> https://www.adafruit.com/product/4681
>
> which has a solder bridge to change the address. I may order a pair of
> these,
> as their lux range looks suitable. It's a bit larger than I'd like (at
> 25x18mm
> it's about 3x bigger than the pair of sensors I'm using now) but seems to
> be
> the only one Adafruit sell that fits the bill. Is it any better than the
> little GA1A12S202 boards I have?
>
> Anyone have any experience with this or could recommend a good light
> sensor?
> And preferably small and relatively cheap? Most of these boards are well
> under US$10, e.g., $2.50, $4.50.
>
> ----
>
> This is all in mind of developing that moth/anti-moth behaviour, where the
> sensor is supported by a Python class that has various possible outputs: an
> Orientation enum indicating where the brightest light is coming from (an
> output of PORT, STBD, or NONE, with a hysteresis setting to permit a center
> point); a bias value from -MAX_V to +MAX_V; a pair of raw floating point
> values from 0.0 to 3.3 (volts); and a pair of ints from 0 to MAX (which is
> calculated as round(v) * 100, in this case 330).
>
> I've got this up and running, supported off two analog input pins on a
> Pimoroni IO Expander board (the little Nuvoton MS51 on the front of my
> robot), so far so good:
>
> https://github.com/ifurusato/ros/blob/master/moth_test.py
> https://github.com/ifurusato/ros/blob/master/lib/moth.py
>
> ----
>
> With our ongoing discussion of PID loops and the use of a PID controller
> for steering a robot, using velocity+rotation rather than left and right
> velocity as the steering model. The idea I had was that if one were using
> a simple proportional PID for steering, to implement a moth or anti-moth
> behaviour it'd be a matter of adding the output from get_bias() to the
> rotation value, multiplied by some kind of fixed constant to control how
> forcefully the robot reacts to changes in light level. I thought about
> having its reaction slow as it got closer and closer to bright light,
> until at a certain threshold it would stop (in moth mode). A bit like my
> cat. This could be used to charge the batteries from a solar panel.
>
> Is this something that anyone in the group has done before? If so I'd be
> interested in hearing of your experience and any advice.
>
> Cheers,
>
> Murray
>
> ...........................................................................
> 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
>
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at lists.dprg.org
> http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dprg.org/pipermail/dprglist-dprg.org/attachments/20210211/c608468a/attachment-0001.html>
More information about the DPRGlist
mailing list