CoSQM - a color hack to the SQM-LE for Light At Night Sensing


User's Manual


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

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

CoSQMv2

January 23, 2022

Creative Commons Attribution-ShareAlike 4.0 International License .

Abstract

The CoSQM is a portable device which aims to sample the multispectral properties of the artificial light scattered by the atmosphere. It is a convenient tool to estimate light pollution and its impact on the environment. CoSQM is an instrument composed of a filter wheel with four different spectral transmittance in the visible range (clear, red, blue, green) that is standing on a step motor in front of a Sky Quality Meter. The device comprise a Raspberry pi open source linux computer so that it can be reproduced by anyone. CoSQM also comprise a camera module. The instrument can be operated remotely via the ssh protocol and the data may be accessed via an integrated web server. This device should better show how humankind can affect their own nocturnal environments. Color detection capability is an important improvement over existing non-imaging detectors in the context of the drastic change in the color of light pollution provided by the transition to the LED technology.

Presentation given at the International interdisciplinary workshop on light pollution - Toward the first dark sky reserve in North Africa, Marrakech, Morocco, October 22-26, 2018

Operation mode

The CoSQM was designed to be used in a permanent installation mode. Note that unclean shutdown of the system may end-up in file system corruption. In such a case the system may fail to restart properly and then will need to be serviced. As a routine step, the CoSQM is restarted around noon local time. This is done automatically by the crond service (see Crontab section below). That time should be set correctly according to the region of installation of the instrument to be sure that it falls during day time around noon. Note that the time zone of any CoSQM must be set to GMT. This is why that reboot time should be changed according to your installation site.

Hardware

Components

The system consists of the following items, but it would certainly be adapted to a different list of items with minor corrections.

Component name Number Picture
Raspberry pi model 4 B 2Gb 1
SanDisk Ultra 32GB microSDHC UHS-I Card 1
Ultra fit 32GB Flash Drive 1
Raspberry Camera Module HQ with 6mm lens 1
TP-link ethernet switch model TL-SF1005D 1
SQM-LE board from Unihedron 1
Neewer 4PCS Standard 1.25 inches Color Filter Set for Telescope Eyepiece: Red Yellow Green Blue 1
5mm Flange Coupling connector - to attach the motor to the filter wheel 1
Longruner NEMA17 Stepper motor 1
40mm heatsink 1
L298N stepper motor driver Board 1
Dual 5V & 12V 10Amp power supply 1
Cole-Parmer Watch Glass, 50 mm - for the main window 2
Raspberry Pi UPS HAT 1
Optoswitch LM393 1
1 FT non booted ethernet cable 2
NBF-32314 BUD industries enclosure 1
NBX-32914-PL BUD industries panel 1
Motherboard switch 1
Red LED 1
Prototype Raspberry hat 1 Attach:protohat.jpg
5V mini fan 1 Attach:rpifan.jpg
1mm thick black fiberglass plate (15x15cm) for the filterwheel encoder 1
male 2.1mm x 5.5mm connectors 1
female 2.1mm x 5.5mm connectors 1
Clear silicone glue - for gluing the watch glasses and window supports -
black nail varnish to attenuate the components LEDs -
330 ohm resistor 1
14.3cm x 17.3cm x 1mm thick aluminum plate 1
M2 10mm self taping screws - to attach motor flange to the filter wheel and to attach the position sensor support to the main support 6
M3 8mm self taping screws - to attach the window supports 8
8 mm M3 screws for the stepper fixation 4
M3 washer for the stepper fixation 4
M3 lock washer for the stepper fixation 8
M3 17mm brass post for the stepper fixation 4
M3 8mm conical head self tap screws to attach the plate to the main support. 6
Brass M2.5 12mm posts to attach the raspberry and the stepper driver board to the main support 6
Brass M2.5 10mm posts to attach ptototyping hat to the UPS hat. 4

Optional components

Component name Number Picture
USB GPS tratux Vk-162 Remote Mount USB GPS (U-blox) 1
SmallRig Multi-Function Mounting Plate 1

Enclosure

We use the Bud industries NEMA box part number NBF-32314 with the associated prototype plate NBX-32914-PL. On the lid, we drill two 1 1/2 inch holes according to the picture below. Four small 1/8 inch holes need to be drilled around each large holes to attach the window supports on the top lid from the inside with the M3 self taping screws. If a fixation plate have to be used, seven 5/16 inch holes should be drilled on the bottom of the box. Some holes also need to be drilled on the side for installing the connector gland and the LED (if the LED is desired). We suggest to let the reboot button inside the enclosure (no need to secure it on the enclosure simple let the cable inside).

3D printed components

There are only 5 printed parts. We recommend the use of PLA material in black color. Black is better to attenuate the light inside the instrument.

You can find the 3D print link of each component below the image of each one.

Main support

 
Main support stl file

Filter wheel

Filter wheel stl file

Windows supports (2 copies)

Window support stl file

Position sensor support

Position sensor stl file

Filter wheel encoder plate

In order to get rid of thermal deformation of the filter wheel, we deciced to make a fiber glass plate on which the filter support is glued. This circular plate show a slot to serve as a zero position encoder for the filter wheel. We suggest to use a CNC router to cut that encoder plate. The sketch of the plate is given below. Along with the corresponding gcode file for the CNC router. The slot on the encoder plate must be aligned with the clear channel position (the filter support hole that will not hold any filter).

Filter wheel encoder plate

Encoder plate svg file
Encoder plate gcode file for CNC router

Filters positions

The filter hole aligned with the slot of the encoder plate must be empty (without filter). Then when looking to the filter wheel from the top, put the Red, Green, Blue and the white diffusing into the following holes (clockwise order)

Optical properties

Angular response of SQM in a linear scale

The angular response is determined using figure 4 of the report on Sky Quality Meter of Pierantonio Cinzano (2007)

Power consumption

The CoSQM typically drive up to 5A (25W). But we found that a 5A power supply sometimes fail to provide the required current. For that reason it is recommended to use a higher power supply capacity. We suggest a >7A 5V power supply and >2A 12V power supply. It is highly recommended to set the power voltage to 5.45 V so that when current peaks appear, the power will remain sufficient for the RPI. The little lightning icon should disappear when the voltage is correctly set. But take care of not going above 5.5 V otherwise you can damage the RPI. 5V will power up the RPI, the SQM, the HUB, and the fan while the 12V power the stepper controller.

Size and weight

  • Size: approx 20 cm x 20 cm x 15 cm
  • Mass: 1.06 kg

Wiring

Pinout informations and GPIO pinout map

Electric sketch
Prototype hat

USB-C power

To benefit of the UPS hat protection, you need to power the RPI through the USB-C connector. If you want you can solder your power wires directly to the RPI PCB. TP1 = 5v and TP7 = GND. In such case, use at least AWG20 stranded wire (not solid core wire). It can also be a good idea to sue hot glue to the wires after soldering to serve as stress relief.

LED

A red LED is installed near the connectors of the CoSQM. This LED will blink at some point to indicate the state of the system. Of course it will not blink during measurement and at least no less than 20 sec to the next measurement to get rid of any contamination of the LED to the measurements. Below are the various signals given by the LED.

Event Signal
Startup of the CoSQM 5s on
Waiting for twilight for filter alignment 19s on, 1s off (loop until the twilight)
Beginning of measurements 10 fast blink
End of a set of 5 filters measurement 3 fast blink

LED wiring

The wiring of the LED is very simple. First it is required to solder a 330 Ohm resistor to the ground pin of the LED (the shortest pin). Then the other end of the resistor must be connected to the ground of the raspberry pi. The other pin of the LED have to be connected to the GPIO 13 (pin 33). Note that in very dark place the LED may be a problem as it can become a significant source of light pollution given its proximity to the SQM. Maybe you can put some black nail varnish on it to attenuate the light level and/or put a back electrical tape over it that can be took off when you really need to see the LED state. In any case you can simply not put any LED, that will not impact the CoSQM at all.

Shutdown/reboot button

The shutdown button should follow the following configuration

The pin numbers below refers to figure "RPI GPIO pin out map".

  • 1 wire connects to Pin 29 (GPIO 05)
  • the other wire connects to the ground (GND)

The RPI will reboot if the button is held for more than two seconds but fewer than five seconds and it will shut down if the button is held for more than five seconds.

Assembly

Assembling steps (see detailed sections below)

  1. Screw the SQM-LE board on the main support with 3 M3 8mm self tap screws
  2. Screw the top aluminum plate on the main support with M3 8mm self tap screws
  3. Screw the camera right angle support on the top aluminum plate with a 1/4-20 3/8in screw
  4. Screw the camera on that right angle support with a 1/4-20 3/8in screw
  5. Put the 6mm lens on the camera
  6. Open the lens aperture to the maximum
  7. Let the camera cable cross the main support by the dedicated slot located below the raspberry pi
  8. Screw the four post with four washers and four lock washers on the stepper
  9. Screw the metal plate on the four posts using four 8mm M3 screws and four lock washers
  10. Screw the motor flange on the filter wheel with four M2 10mm self tap screws
  11. Screw the flange on the stepper shaft and secure the two screws
  12. Glue the color filters into onto the filter wheel. The hole close to the position encoding slot remains empty. Then as seen from the top the filter order clockwise is Red, Green, Blue, white diffuser disk.
  13. Install the filter wheel on the motor
  14. Screw the optoswitch on the position sensor support
  15. Screw the position sensor support on the main support
  16. Insert the pre-installed microSD card in to the relevant slot of the RPI
  17. Insert the flash drive in a USB 3.0 port on the RPI (the port with the blue color)
  18. Attach the RPI to the main support with two 12mm brass post provided with the UPS and with two 8mm M3 self tap screws
  19. Attach the UPS hat to the RPI and plug in the battery on the USP hat
  20. Attach the prototype hat on the UPS hat
  21. Screw the stepper controler on the base plate with brass posts
  22. Glue the networt hub on the base plate with double face tape under the motor.
  23. Install a small 5V fan on the main support (on one leg of the main support close to the camera) to push fresh air toward the RPI.
  24. Connect the 3 network cables as indicated in the section below
  25. Connect the stepper motor cable to the motor
  26. Set focus of the camera to infinite (using raspicam software)
  27. Prepare the holes / windows of the enclosure (see below section)

Main support

An 1mm thick aluminum plate have to be screwed to the top of the main support with 4 self tap M3 screws. That plate is supporting the stepper and block possible light contamination coming from underneath components. This plate also assure a certain level of heat dissipation protecting the support from over heating. The image below show the plate when installed on the main support. The small holes are 9/64in in diameter and the two large holes are 7/8in in diameter.

On that supporting plate, the right angle camera support (see image below) have to be screwed with 1/4-20 screw. We suggest to use the same thickness as for the plate. The two holes may have a diameter of 33/64in.

All components

  • To make sure that the lights inside the CoSQM will not affect on the measurements, hide the light from the camera with duct seal or electrical compound.
  • Be sure to clean the 3D printed components by gently sanding the surface and the holes.
  • Attach the TP-link ethernet switch to the enclosure prototyping plate with double face tape.

Window supports

  • Apply a clear silicone glue on the outline of the windows on the top lid and place the watch glass on them.
  • Apply clear silicone glue under the window supports to seal with the enclosure lid.
  • Perform a leak test of the windows by filling the top lid upside down with water.

Welds

We recommend to weld the wires on a prototype hat.

Ethernet wire connections

Make the connections in the following order :

  • 1 Ft non booted ethernet cable from the raspberry pi to the TP-link ethernet switch.
  • 1 Ft non booted ethernet cable from the SQM-LE board to the TP-link ethernet switch.
  • 1 Ft ethernet panel mount cable to the TP-link ethernet switch.

Stepper motor

Use the 18 mm M3 screws to secure the motor on the main support. Be sure to put the washers and the lock washers between the screws heads and the support. This is important because that the vibrations produced by the motor can lead to the screws to unscrew with time.

The stepper motor can become quite hot. To reduce the surface temperature of the motor, install a heat sink on it, under the motor. This is an important step to protect the PLA main support from suffering of excessive heat.

Setting up the CoSQM for measurements

Install the instrument to point the relevant part of the sky. Normally the zenith is the direction that must be preferred. Be sure that the sky is clear from blocking structure to allow the GPS to connect correctly (if a GPS is used). One must also put some near horizon obstacles to block the direct light from important sources near horizon. If such source hit the optical window, there is a possibility for that light to interfere with the light coming from the sky after multiple reflection into the window. Even if the CoSQM can comprise a GPS, it is not designed to be used in a roadrunner mode.

Starting the CoSQM

CoSQM is trivial to startup. All you have to do is to plug the power connector to the grid. The RPI will then boot and will automatically startup the observation script. The data will be stored into the relevant /data directory accessible to the web server. If the ethernet cable is connected to a local network with 192.168.0.* root, you will be able to access the instrument remotely for any station in that network. You can both connect via ssh or http. The standard IP used by the CoSQM is 192.168.0.100.

Downloading the data

Wired connection

The data are stored into the micro SD card of the Raspberry pi (RPI). In order to access the data, an apache2 web server is configured on the RPI. You can browse the data simply from a web page using the following URL http://192.168.0.100/data . To do that you first need to plug the network cable of your computer to a router of switch in the sub net 192.168.0.* and configure your pc IPV4 connexion properties. You need to set it to manual configuration mode then set the IP address, net mask and route/gateway according to the following table.

IP address 192.168.0.200
Netmask 255.255.255.0
Route/Gateway 192.168.0.1

Once configured, restart your interface, open a web browser and enter the following address in the address bar. Note that the "200" in your computer IP can be replaced by any other address and depending on the local network configuration, a automatic DHCP IP attribution can work.

To access the data, type this in your browser:

192.168.0.100/data

You should then see a directory tree and will be able to visualize the text data along with the camera images. The data is organized by year and month.

You can also download all the data by using the following command on a linux command line:

The data will be download and stored in a local directory named 192.168.0.100

Wifi access

You can alternatively connect to the cosqm wifi network to access the web server (or the ssh). The wifi SSID is cosqm and the passphrase is cosqmwifi. Your device IP will then be set automatically (if you are using DHCP) to a value between 192.168.5.2 and 192.168.5.20. To access the data, simply do the same as for the wired connection explained above using IP 192.168.0.100 .

Data format and size

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

  1. Date
  2. GMT time
  3. Latitude
  4. Longitude
  5. Elevation
  6. SQM temperature (C)
  7. Integration time (s)
  8. Clear SQM reading (mag arcsec-2)
  9. Red SQM reading (mag arcsec-2)
  10. Green SQM reading (mag arcsec-2)
  11. Blue SQM reading (mag arcsec-2)
  12. Yellow SQM reading (mag arcsec-2)
  13. Clear radiance (W m-2 sr-1)
  14. Red radiance (W m-2 sr-1)
  15. Green radiance (W m-2 sr-1)
  16. Blue radiance (W m-2 sr-1)
  17. Yellow radiance (W m-2 sr-1)

The radiances are calculated using equation 5 of Sánchez de Miguel et al. (2017)1 .

1Sánchez de Miguel, A., Aubé, M., Zamorano, J., Kocifaj, M., Roby, J., & Tapia, C. (2017). Sky Quality Meter measurements in a colour-changing world. Monthly Notices of the Royal Astronomical Society, 467(3), 2966-2979.

The average size of a complete day of measurements is about 38 kB and the images for the same day period is 4.3 MB. Considering the available memory on the 32 GB micro SD card, it is possible to run the system without emptying the card during about 13 years.

Shutdown of the CoSQM

A Shutdown/reboot button is provided at the bottom of the instrument. Please never power off the instrument by unplugging directly the power cable. Sometimes, doing so may result in data corruption problems on the RPI micro-SD card. When you push the power button, a signal is sent to the RPI for a safe shutdown. You have to press the button for at least 5 seconds for a shutdown to be initiated. Please wait about a minute after pushing the power button before unplugging the power cable.

$StopWatch