LANcube - a multispectral and multiangular sensor for the light at night


LANcube v2 User's Manual


Martin Aubé1, Ph.D. (PI)

Élysé Lapalme1

1 Cégep de Sherbrooke, Sherbrooke, Québec, Canada

Creative Commons Attribution-ShareAlike 4.0 International License

Last update: June 5 2022

Abstract

LANcube (LAN3) is a device intended to sample the multispectral and multidirectional properties of the direct artificial light at night into the urban or natural environment (indoor or outdoor). It is a powerful tool to foster new research in the fields of the impact of artificial light at night on human health and natural environments. LAN3 is a cube having on five of of its face four sensors of various spectral response (band) in the visible range (red, green, blue and clear). Each band has been calibrated in a way to deliver the integrated fluxes. Thanks to its multispectral capabilities, the sensor can provide an estimate of the illuminance, of the correlated color temperature (CCT), the Melatonin Suppression Index (MSI), the Induced Photosynthesis Index (IPI) and the Star Light Index (SLI). The minimum light level detected is 0.005 lux. LAN3 is based on raspberry pi/arduino open source hardware so that it can be replicated by anybody. It comprise a real time clock, a mode selector, a status LED, a web server, GPS module. LAN3 act as a wifi access point so that it is possible to dowload the data or check it's status with any mobile device.

User's guide

Power source

The LAN3 need to be powered using a USB-C cable. Since that the system needs around 3 Amp, you need a USB-C cable rated for that current and more importantly a power source capable to deliver such current.

Keeping GMT time

The LANcube is supposed to be synchronized with the GMT time. The LANcube comprise a Real Time Clock chip powered by a battery so that the time should be kept even after removing the power. But after a few month without connecting the LANcube to its power supply, the battery may becomes empty and then the time will be lost. If it happens, the date will be resetted to 2000-01-01. The new data should be recorded anyway but in the wrong file. The best way to avoid that problem is to connect the power supply of the LANcube for a few hours every 1 month with the switch in position 0. That will charge the battery and the GMT time will remains correct. That will also protect the battery life.

If ever the time is lost, you can recover it by connecting a network cable between the LANcube and a internet-connected router that is using local network 192.168.0.X. You can check if the time is correct by typing the LANcube ip address in a web browser (even from the local network or by connecting to the wifi and use 192.168.5.1 URL).

If the time is still wrong, you can configure it manually with the following sequence:

sudo date +%Y%m%d -s "20120418"
sudo date +%T -s "11:14:00"

Please replace the date and time above by your actual GMT time.

Then you can write the new time into the hardware real time clock that will be kept as long as the battery is not completely empty.

sudo hwclock -w

Operating button

Measuring (I)

Putting the button to position (I) will start the measuring sequences.

If any data is over/under exposed, the LED will turn solid blue. If all data are correctly exposed, but no GPS signal is found, the LED will turn solid yellow. Lastly, if all data are correctly exposed and GPS location is acquired, the LED will turn solid Green.

Idle (0)

Putting the button to position (0) will stop the measurements (if you are measuring). Note that the ongoing sequence will terminate first (all sensors will be sampled). This position is also the one to use when you power on the system before connecting the USB-C power cable.

In that mode, the LED is yellow and flash at a constant rate of 0.5 sec on, 0.5 sec off.

Off/shutdown (II)

This mode is activated by putting the button in position (II). When you use it to shutdown the system, wait about 10 seconds before removing the power cable. Don't let the button to position (II) if you want to start using the LAN3. Otherwise it will shutdown right after boot.

When the button is set to this position, The LED turn Red.

After a shutdown, if you want to start the system you need to wait about 30 seconds unplugged. This is the time for the power stored in the condensers of the UPS hat to be emptied. After that time you can just plug back the USB-C cable with button in position (I) and the LAN3 will restart properly.

LED status indicator

  • Red = shutdown
  • Yellow blink = Idle
  • Blue = Over or under exposed but GPS ok
  • Purple = Over or under exposed but no GPS
  • Yellow = Data ok but no GPS
  • Green = Everything ok
ShutdownIdleOver or under exposed with GPSOver or under exposed without GPSData OK no GPSEverything OK
SOLID REDYELLOW BLINK SOLID BLUESOLID PURPLESOLID YELLOWSOLID GREEN

Access to the data

Connecting to the LAN3 wifi

It is possible to access the LAN3 from any mobile device. The only requirement is that this device have a wifi interface. The LAN3 is configured in a way that its wifi interface act as a wifi access point.

To connect with your mobile device, you need to go to the network configuration and connect to the wifi network named lan3v2. The passphrase is lan3v2wifi.

Once connected, you can do one of the following method to access the data:

Access through a web browser

See the 5s updated measurements

Enter the following address in your web browser:

192.168.5.1

Use the update button of you browser to refresh the data. The native LAN3 sampling rate if of about 0.2 sec but that web page is only updated every 5 seconds.

Access the complete data

Enter the following address in your web browser:

192.168.5.1/data

In that directory your will find .csv files. To look at the file content simply click on the file name and chose the appropriate application to open it. A simple text editor/viewer is far enough.

To save a file, simply use save as...

Access with a SSH client

This is by far the most powerful way to access the system. In the other hand, it is a bit more complex.

You need a ssh client installed on your device. You enter the following in the client:

ssh sand@192.168.5.1

Then move to the web server directory containing the data

cd /var/www/html/data

You can see the list of files by typing

If you want to see the latest recorded data simply type the following

tail name_of_the_csv_file

You can download the file with a scp client (some ssh clients can do).

On apple or linux in a terminal window you can simply type the following command (adapt the file name to the one you want).

scp sand@192.168.5.1:/var/www/html/data/name_of_the_csv_file .

If you want to download all files, replace the name_of_the_csv_file by *

scp sand@192.168.5.1:/var/www/html/data/* .

Data format

The data is structured in the following way for each equivalent column number:

Sensor_number Year Month Day Hour Min Sec LAT LON ALT Number_Of_Sat Gain Integration_time Correlated_color_temperature(K) Illuminance(Lux) Red_DN Green_DN Blue_DN Clear_DN Data_status

EX: 'S5 2020 12 21 00 00 43.12 n/a n/a n/a XX 60.00 38.40 5332 460.2480 910 990 790 2449 OK'

  • Illuminance in Lux is optimized for phosphor converted LED lights
  • Correlated_color_temperature is the default value calculated with the manufacturer library. This value seem to be more accurate for incandescent and fluorescent lamps. The CCD appear to be less accurate for LEDs.
  • DN means digital number. This is the raw value at the sensor level for each color.
  • Data status can be:
    • UE = Under Exposed when any band of the sensor record a Digital number (DN) below 100.
    • OE = Over Exposed when any band of the sensor record a Digital number (DN) above 40000.
    • OK = Everything is for the best in the best of all possible worlds.

Data backup

The LAN3 is provided with a USB stick on which a backup of the data is made every 15 minutes.

Spectral response

The Infrared signal (IR) may be estimated from the R, G, B values using the following equation:

Afterwards we can determine the signal free of the IR contribution using this equation:

It appear that g is a good proxy of the illuminance in Lux.

The spectral response of the different bands of the LANcube are given in Fig. 1.

Builder's guide

Hardware

From the outside, the LAN3 version 2 have a 3 way switch, a RGB LED, a USB cable and a GPS dongle. The USB cable is for powering the system, you need to provide 5V with at least 3 Amp. The power source can be either a phone charger or a power bank. If you notice that after about 1 minute, the LAN3 shut down, it means that your power sources in not powerful enough. If connected to a network the ethernet cable allow to access the integrated web server for an easy access to the data but this cable is optional because that you can connect with WiFi using any mobile device. In a permanent installation, the etheret cable can be connected to the internet, if one want to control or monitor the system remotely. The RGB LED serve as a system state indicator. The 3-way switch positions corresponds to 3 different functions. (0)=IDLE, (I)=Data acquisition, (II)=Shutdown.

Components list

The system consists of the following items:

Component name Number Picture
Raspberry pi model 4 B 2Gb 1
SanDisk Ultra 32GB microSDHC UHS-I Card 1
Ultra fit 32GB Flash Drive (optional) 1
Cole-Parmer Watch Glass, 25 mm - for the sensors windows 5
Raspberry Pi UPS HAT 1
TCS 34725 color sensor 5
Black PLA 3D filament to print the enclosure -
3 way switch 1
RGB LED 5mm 4 pins 1 Attach:RGBLED.jpg
Prototype Raspberry hat 1 Attach:protohat.jpg
Clear silicone glue - for gluing the watch glasses -
USB GPS tratux Vk-162 Remote Mount USB GPS (U-blox) 1
7 pin Female jumper wire assembly to connect to sensors 5
Mounting Plate 1
Brass M2.5 12mm posts to attach the UPS hat to the raspberry and the raspberry to the box 4
Brass M2.5 10mm posts to attach the prototype hat to the UPS hat 4
M2.5 screws to secure the prototype hat to the UPS hat 4
M2 5mm self tap screws to attach the sensors to the enclosure 10
M4 8mm screws to attach the mounting plate to the enclosure 2
M4 12mm self tap screws to attach the lid to the box 4
USB-C male to USB-A male cable 1
USB power bank or 5V 4A power supply 1

Enclosure

Main enclosure

We decided to 3D print the enclosure to get the device as small as possible. The enclosure measures about 9 x 9 x 9 cm. The total mass with components is 345g including the gps module but excluding the power supply/power bank. One face of the LAN3 have the 3-way switch and the RGB LED. This face act as a reference for the orientation of the LAN3. Assuming that in a road runner mode, this face should point backward.

The rear face hold the sensor #2, the right face the sensor #3, the front face sensor #4, the left face sensor #5, and the top lid holds sensor #1.

FaceSensor NoNote
Rear2Face with switch
Front4Face with USB-C port and micro HDMI
Right3Face with microSD card
Left5Face with USB and ethernet ports
Top1 

3D printed components

Wiring

  • TCS34725 light sensors
    • Sensor 1 SDA -> green wire -> rpi pin 29
    • Sensor 1 SCL -> yellow wire -> rpi pin 31
    • Sensor 2 SDA -> green wire -> rpi pin 15
    • Sensor 2 SCL -> yellow wire -> rpi pin 22
    • Sensor 3 SDA -> green wire -> rpi pin 16
    • Sensor 3 SCL -> yellow wire -> rpi pin 18
    • Sensor 4 SDA -> green wire -> rpi pin 32
    • Sensor 4 SCL -> yellow wire -> rpi pin 36
    • Sensor 5 SDA -> green wire -> rpi pin 33
    • Sensor 5 SCL -> yellow wire -> rpi pin 35
    • All sensors VIN -> brown wire -> rpi 3.3V out
    • All sensors GND -> black wire -> rpi GND
    • All sensors LED -> red wire -> GND
  • RGB LED
    • Pin 1 (RED) next to the longest -> rpi pin 38
    • Pin 2 (GND) -> rpi GND (longest)
    • Pin 3 (GREEN) -> rpi pin 40
    • Pin 4 (BLUE) -> rpi pin 37
  • Button
    • Middle (O side) -> rpi 3.3V out
    • I side -> rpi pin 19
    • II side -> rpi pin 21

The UPS hat uses rpi pin 11 and 13. No wiring is required as their GPIO ports are connected.

Wiring picture

Mechanical Assembly

Assembling steps

  1. Solder 3 wires on the 3-way switch
  2. Solder the wires and the resistor to the LED
  3. Insert the 3-way switch in the rectangular hole
  4. Put small numbered labels next to each sensor position inside the box and put the corresponding labels on the back of each sensor.
  5. Screw four hexagonal brass posts to attach the raspberry to the box.
  6. Screw the sensors on each pellet with M2 5mm self tap screws
  7. Screw four brass posts on the raspberry
  8. Plug the battery on the UPS hat
  9. Insert the UPS hat on the Raspberry
  10. Screw four brass posts on the UPS hat
  11. Insert the prototype hat on the UPS hat and secure it with M2.5 screws
  12. Plug the GPS dongle in a USB port of the Raspberry pi.
  13. Insert the RGB LED in the small hole in the enclosure (next to the 3-way switch) and glue it with superglue.
  14. Glue the 4 rubber feet under the box
  15. Secure the mounting plate to the box
  16. Clean the watch glasses and glue them with silicone glue.
  17. Solder all sensor cables to the prototype hat according to the wiring section
  18. Solder the LED cables to the prototype hat according to the wiring section
  19. Solder the switch cables to the prototype hat according to the wiring section
  20. Connect the USB cable to the raspberry pi
  21. Set the switch to 0 position
  22. Power up the USB cable.

Software installations

Software installation guide

$StopWatch