build details

# DEMO - Light sensors

Modified 2019-08-29 by gerni17

A fully operational Duckietown (unknown ref opmanual_duckietown/duckietowns)

previous warning next (5 of 8) index
warning
```I will ignore this because it is an external link.

> I do not know what is indicated by the link '#opmanual_duckietown/duckietowns'.```

Location not known more precisely.

Created by function `n/a` in module `n/a`.
with watchtowers built to right specs. TODO : add the name of the right specs

Accurate measure of the light field of the Autolab

This container will show you how to mount the Adafruit TCS34725 sensor on a watchtower and how to correctly plug it in.

## Hardware setup

Modified 2019-08-29 by gerni17

### Requirements

Modified 2019-08-29 by gerni17

the upper plate of the watchtower need apposite holes to fit the sensor.

### Soldering

Modified 2019-08-29 by gerni17

The first thing to do is to solder the pin headers to the actual sensor: To do so the easiest way is to use a breadboard and cut a few pin headers in order to get a nice 90-degree angle between the sensor and the pins.

### Fix the sensor to the watchtower plate.

Modified 2019-08-29 by gerni17

To do so put the pin headers into the big hole and fix it with the screws.

### Wire the sensor to the watchtower

Modified 2020-07-18 by Andrea Censi

The best way to figure out how to do this is to always take the sensor and turn it until you can read what is written on it and that will be our basic position.

Plugins on the raspberry-pi:

o o 1 o o

2 3 4 o 5

Plugins on TCS34725:

o 1 2 4 3 o 5

This is the pin layout, every number corresponds to a wire color (it doesn’t matter which color is which number but just make sure that the wire is connected to the right pin header).

Now the hardware construction part should be done.

## Software setup

Modified 2019-08-29 by gerni17

### Requirements

*A sensor which is correctly setup on a running watchtower. Ideally an external light sensor that measures luminescence in [lux] that can be used as reference.

*An environment where you can control the light intensity, it can also be very small (try to use two light intensities below and above the operating point).

### Introduction

Modified 2019-08-29 by gerni17

To calibrate the sensor we need to measure the light at two different intensities in order to be able to make a linear approximation. To do so we measure two different light intensities and input the expected values to the sensor and then make a linear approximation.

To do so measure the two intensities by running the container and follow the steps of the instruction provided on the console (don’t forget that you need an external reference sensor as well).

### Run the calibration

Modified 2019-08-29 by gerni17

You can pull the image of the docker container to the agent

### Check calibration of sensor

Modified 2019-08-29 by gerni17

You can check the calibration by going to the calibration folder, TODO

## Run

Modified 2020-07-18 by Andrea Censi

To run the sensor container first you need to pull the image:

``````$docker -H HOSTNAME.local pull gian1717/sensor:p2 `````` And then start the container: ``````$ docker -H HOSTNAME.local run -it  --net host --privileged --name light-sensor -v /data:/data gian1717/sensor:p2
``````

If you want to know more:

The whole sensor software is on my GitHub account , on the repository light sensor, sensor calibration.