AllSky7 Sensor Board Manual (Rev 1.1)
Components
The sensor board consists of the following hardware components:
- Raspberry Pi Pico RP2040-ETH micro-controller with CH9120 Ethernet chip and USB-C connector
- Internal temperature and humidity sensor
- buck converter 12V -> 5V
- GPS receiver
Note: The GPS antenna must be attached the the receiver and mounted horizontally inside the dome with the sensor point on top. The sensor support different signals like
GPS (USA), BEIDOU (China), GALILEO (EU), GLONASS (Russia) and QZSS (Japan)
- 12V power in
- 12V power out
- 5V power out
- Connector for external temperature and humidity sensor
- 3.3V power out
- relay add-on (optional)
Purpose
The purpose of the device is to determine certain parameters from inside the AllSky7 cameras:
- GPS position
- 1PPS time signal
- temperature and humidity inside the dome
- temperature and humidity outside the dome
In addition, the device provides different voltages and digital ports for further sensors.
An optional relay can control additional hardware like heaters, coolers or fans based on the climate conditions inside and outside the dome.
Note that the power consumption for heaters and coolers is too large to be provided by the camera itself. So you need to provide a separate power supply.
Mounting
The device is mounted below the zenith cameras. It is powered by 12V, and connected via an Ethernet cable to the Ethernet switch inside the camera dome.
Interface
The device has a static IP address 192.168.76.70. Communication is conducted via HTTP and can be initiated via curl, as in the following examples.
- curl http://192.168.76.70/get_help - returns a help text with available services
- curl http://192.168.76.70/get_version - returns the firmware and configuration file version
- curl http://192.168.76.70/get_sensor - returns current sensor data in JSON format
- curl http://192.168.76.70/set_debug?device=< usb | ether | file > - configure that log output is written to the serial port (USB), the Ethernet port or a local debug file
Note: You can listen to the debug output on ethernet with curl --ignore-content-length http://192.168.76.70/
- curl http://192.168.76.70/set_debug?level=< none | ether | noether | gps | nogps | sensor | nosensor | relay | norelay | config | noconfig | pps | nopps | flash | noflash | log | nolog | all > - activates or deactivates certain debug information
Note: You can add further debug information by calling the service multiple times, and deativate all debugging with level=none
- curl [-o filename] http://192.168.76.70/get_log?type=< sensor | debug > - returns the sensor logfile in CSV or the debug logfile in TXT format and stores it optionally with the given filename
Note: The HTML header will contain a CRC32 value of the file. Pls. check the value before you purge the logfile
- curl http://192.168.76.70/purge_log?type=< sensor | debug > - purges the sensor or debug logfile
- curl http://192.168.76.70/format_fs - formats the LitteFS filesystem
Note: This will delete the configuration file and all logfiles
- curl http://192.168.76.70/do_reset - resets the sensor board
- curl --data-binary @image.bin -H /"FileSize: xxxxxx/" -H /"CRC: xxxxxxxx/" http://192.168.76.70/put_firmware -
uploads a firmware file named image.bin
Note: CRC is the CRC32 value of the file, and Filesize the length of the file. Both parameters are mandatory and will be checked by the device
- curl http://192.168.76.70/do_update - executes the update to a new firmware version which was uploaded before
- curl --data-binary @config.csv -H /"CRC: xxxxxxxx/" http://192.168.76.70/put_config - uploads a configuration file named config.csv
Note: The configuration file version must match to the firmware version. The CRC parameter is optional.
Configuration File
You can configure the device by uploading a configuration file.
Here is a sample configuration file.
# configuration file for AllSky7 Sensor Board
version,1.0
temp,0,5
hum,90,70
dewpoint,3,10
sensor,dp
led,on
sensorlog,1
debugdevice,usb
debuglevel,all
Everthing behind a hash sign (#) is regarded as remark and omitted.
The following parameters can be configured:
- version: Configuration file version. This is the only mandatory parameter and it must be in the first line of the configuration file, which is not a comment line. The file version must match to the file version supported by the device firmware.
- temp - temperature at which the relay is to be switched on and off
- hum - humidity at which the relay is to be switched on and off
- dewpoint - difference between outside temperate and dewpoint inside the dome at which the relay is to be switched on and off
- sensor - which sensor shall trigger the relay: inside (in) or outside (out) the dome, or dew point (dp)
- led - shall the LED display the sensor board status (on) or shall it remain dark (off)
- sensorlog - frequency at which sensor log data are written (in min)
- debugdevice - to which device shall debug log data be written: serial port (usb), ethernet port (ether) or local debug file (file)
- debuglevel - which debug information shall be written: none, ether, gps, sensor, relay, config, pps, flash, log, all
Note: this line can be given multiple times in the config file
When you install a heating device, the temperature for switching the relay on should be lower than the switch off temperature, or the humiditidy for switching it on should be higher than the switch off humidity. In case of a cooling device of fan, the values should be vice versa.
Sensor Data
Here is a typical JSON record which is returned from a get_sensor HTTP request:
{
"firmwareversion":"1.1",
"firmwaredate":"2024/12/22",
"hardwaretype":"Waveshare RP2040-ETH",
"intemperature":"37.6",
"inhumidity":"29",
"outtemperature":"22.7",
"outhumidity":"39",
"longitude":"12.631270",
"latitude":"52.494991",
"altitude":"39",
"direction":"38",
"velocity":"0.0",
"utcdate":"2024/12/25",
"utctime":"21:50:12.602",
"satellites":"6",
"hdop":"2.9",
"accuracy":"low"
}
Most of the attributes are self-explanatory. direction and velocity are measures from the GPS sensor in case the camera is moving.
utcdate and utctime are the time when the get_sensor HTTP request was received by the decide, accurate to ~1ms.
satellites are the number of satellites used for the GPS solution and hdop the horizontal dilution of precision, a measure of the quality of the signal.
accuracy translates the hdop value to low, medium or high accuracy.
Monitoring and Logging
The micro-controller has 2MB of flash memory, half of which is used for the internal LittleFS file system.
All sensor data will be written in regular, defined intervals to a local logfile. Note that only 1 MB of flash data is available. If every minute a log entry is written, the filesystem will be full in about 4 days. In order not to loose sensor data, you should regularly download the logfile, and purge it thereafter.
You can use the sensor data logfile to display the sensor value change over time and determine critical values, e.g. when the dome is fogging from the inside.
For debug purposes you can write certain device logdata into a local logfile, or to the Serial or Ethernet port.
Note that sending debug outpout to the ethernet port will interfer with the output of other HTTP requests.
Depending of the status of the device, the LED on the micro-controller shows the following colors:
- green - all sensors detected, filesystem accessible, relay if off
- blue - relay is on
- yellow - some sensor data could (not yet) be retrieved
Note: It may take some minutes until the GPS position is available
- red - at least one temperature and humidity sensor is not responding
Firmware Upgrade
To upgrade the firmware, upload the new firmware file together with the file size and CRC32 fingerprint to the device with the corresponding HTTP command.
If the upload was successful, you can execute the update, which takes less than a second, via the next command.
If there are breaking changes in the format of the configuration file, you should format the filesystem beforehand.
The next image shows typical steps of a firware upgrade.
Alternatively, you can connect the device via USB and upload the new firmware via the file explorer.
Known Issues
Due to a problem with the provided Ethernet library, the HTTP data gets often corrupted during the transfer. This results in malformed requests or incomplete uploads and downloads.
If your HTTP service request returns an error message, or if the CRC of the file upload is incorrect, just repeat the HTTP call until it is successful.
If you download logdata, calculate the CRC32 value of the file (e.g. with 7-ZIP: 7z.exe h < filename >) and compare it with the CRC value given in the return header.
Alternatively, if you upload a configuration file and want to make sure it is not getting corruped, add the CRC32 values to the HTML header.
If it is not matching, try the download again.