Skip to content

Sequent Microsystems Boards

johnny2678 edited this page Feb 7, 2022 · 15 revisions

Sequent Smart Fan

The Sequent Smart Fan can be used to cool your Raspberry Pi.

Setup

Add to I2C Bus

The Smart Fan should show up on ID 3 for the first fan, or ID 4 if you change the jumper to make this a second fan. Sequent Smart Fan Setup

Device Screen

Once you save the device the following information/options will be available:

image

Device Info

  1. Hardware and firmware version
  2. CPU Temp - Unlike the BAS/BAH, the Smart Fan does not have built in support for reading the Raspberry Pi CPU temperature. To input this temperature, create a feed from the BAS/BAH or use the CPU Temperature (Linux) generic device.

Readings

  1. Fan Temp - Temperature that the hat senses (not the Pi CPU)
  2. Fan Power as read from the hat as a percentage 0-100%

Settings

  1. Fan Safe Temp - This temperature can be set and if the Fan Temp reaches this temperature, the Fan Power will automatically be set to 100%. Note - values will convert if you change the units but acceptable ranges are 30-80°C, 86-176°F, or 303°K to 353°K
  2. Units - Can be set to Celsius, Fahrenheit, or Kelvin. Note - this only changes the display value; the hat will always be sent values in Celsius.
  3. Blinky Light - Turns on/off the light on the Smart Fan Board. When enabled, if the fan is off, the LED blinks 1 time per second; when the fan is turned on, the LED blinks between 2 to 10 times per second, proportional with the speed of the fan.
  4. Polling Interval - How often (in ms) should the script run to read the values/update the fan power.
  5. Fan Power Script - This is a plain javascript function that enables you to be as creative as you want in setting the fan speed. The backend code will round any decimals to the nearest integer and bound the values to 0-100%.

The script has access to the following variables:

  • values.units - C, F or K.
  • values.fanTemp - Current temperature read by fan hat (in selected units)
  • values.fanPower - Current set fan power (1-100)
  • options.readInterval - Amount of time (ms) between script evaluation and device polling
  • options.fanSafeTemp - See above
  • options.blink - See above
  • options.units - [Use values.units in favor of this]
  • info.cpuTemp - CPU Temperature from incoming feed, if enabled

Examples (examples here represent F values):

  • Off: return 0;
  • Constant power @ 33%: return 33;
  • Stair-step based of fan temp:
    if (values.fanTemp > 100) { return 33; }
    else if (values.fanTemp > 120 { return 50; }
    else if (values.fanTemp > 150 { return 100; }
    else return 0;
  • Linear progression based on cpu temp:
    // will start at 100 degrees and constantly increase speed until 180 degrees at which point it will remain at 100%;
    // will evaluate to 0 below 100 because of the bounding on REM
    let slope = 1.2 / 1;
    return slope * info.cpuTemp - 120;
    image
  • Log curve based on cpu temp:
    // will start at ~100 degrees and increase logarithmically until 180 degrees
    // Plug this into a graphic app like Desmos.com: y=a\log_{b}\left(x-h\right)+k
    let b = 1.6;
    let a = 10;
    let h = 100;  // lower bound of temperature; below this will be 0
    let k = 5;
    let logBase = 1 / Math.log(b);
    let log = Math.log(Math.max(0.1, info.cpuTemp-h)) * logBase;  // the Math.max is necessary to avoid infinity or isNaN errors
    return a*log + k;
    image
  • Exponential curve ramping up with hotter temps:
    // will start at 0 degrees and increase logarithmically until 167 degrees at which point it will reach 100%
    // Plug this into a graphic app like Desmos.com: y=a\left(b^{x}\right)
    let a = 1.6;
    let b = 1.025
    return a*(Math.pow(b,info.cpuTemp));
    image

Sequent [Super] Watchdog

The Sequent Super Watchdog can be used to provide battery backup and automatically shutdown your Pi.

Setup

Add to I2C Bus

The Watchdog will show up on ID 48 (0x30).

image

Device Screen

Once you save the device the following information/options will be available:

image

Device Info

  1. Hardware and firmware version
  2. Script result - Result of the script (See settings below)

Readings

  1. Charging Status - For the battery one of off, charging, charge complete, fault, unknown.
  2. Pi Voltage - Power being provided to the Pi
  3. Source Voltage - As measured on the Watchdog
  4. Battery Voltage - Watchdog battery voltage
  5. WDT Restart - Number of times watchdog has restarted the Pi
  6. Reset Count - Press the button to zero out the WDT Restart count
  7. Temp - Temp of the board(?)

Settings

  1. Units - Can be set to Celsius, Fahrenheit, or Kelvin. Only affects the display of the temp.
  2. Dev. Polling Interval - How often (in ms) should the script run to read the values/run the script/reset the watchdog timer. NOTE: This time MUST be shorter than the period or the watchdog will restart the Pi.
  3. Period - The period is the interval at which the watchdog will reboot the Pi if no keep-alive (aka reset) is received. Set to 0 for disabled (no watchdog). Min is 1s (per the spec, but never set it below 3s) and max is 65,535s (~18h 12m hours). This value must be higher than the device polling interval.
  4. Default Period - The default period is the amount of time after a reboot that the Pi will reset if it doesn't receive a keep-alive (aka reset) signal. Default is 270s; min is 11s and max is 64,999s (~18 hours). This value must be higher than the device polling interval.
  5. Off Interval - Set the off interval (seconds), The Raspberry will kept off this amount of time when the repower operation is performed.
  6. Repower on Battery - "if the watchdog power off the Raspberry, will repower on battery only if this is true." (from the Sequent Github scripts)
  7. Power Button Enable - Enable or disable an external power button.
  8. Script - BE VERY CAREFUL. This script can wreak havoc if you aren't careful. The script is evaluated with every poll (see device polling interval). You can set it to watch for certain power/battery conditions and automatically shut down your Pi.

Whatever value is returned (as a string) will be displayed in the UI.

The script has access to the following variables:

  • values.units - C, F or K.
  • values.chargeStatus
  • values.raspiVolts
  • values.sourceVolts
  • values.batteryVolts
  • value.watchdogRestarts
  • values.temp
  • options.readInterval - Amount of time (ms) between script evaluation and device polling
  • options.period
  • options.defaultPeriod
  • options.offInterval
  • options.rePowerOnBattery
  • options.powerButtonEnabled
  • options.name
  • options.units - [Use values.units in favor of this]
  • exec - used to run shell commands. See child process.

Example:

  • If the battery volts are <3 and the battery is not charging, shutdown/halt the Pi in 1 minute and stop PM2 processes immediately:
    if (values.batteryVolts < 3 && values.chargeStatus.toLowerCase() !== `charging`) {
        exec('sudo shutdown --halt --poweroff; pm2 stop all;', (error, stdout, stderr) => {
           if (error !== null) return error;
           if (stderr !== '') return stderr;
           return stdout;
        })
    }
    return `OK: ${new Date().toLocaleString()}`;

Sequent Building Automation Hat (MEGA-BAS)

The building automation hat is a very versatile I/O device. REM can control all aspects of this hat allowing you to configure multiple sensors.

Setup

Add to I2C Bus

The MEGA-BAS should show up on ID 72 for the first installed card. If it isn't automatically detected on the I2c tab then click the + symbol on the devices list and enter the address you selected for the card. Refer to the user manual for setting the address jumper. Sequent MEGA-BAS User Guide

Select the address for the card, check the Is Active checkbox and select the MEGA-BAS device type from the device dropdown. image

Then after perform the above steps press the Save Device button. This will add the MEGA-BAS into REM so that it can be configured.

Device Options

The device options tab is used to configure the inputs and outputs on the MEGA-BAS. From the Device Options tab you can very easily configure the board to read sensors, output signals to other controllers, and set up the RS485 port.

General Tab

The general tab will allow you to name the device and display the hardware and software version for the processor on the MEGA-BAS. There is also a monitoring for the input voltage if you are powering the pi from the MEGA-BAS. This card supports a 24v AC or DC input that will power the pi and peripherals.

NOTE: If you are using a 24vdc power supply the input voltage is taken after a bridge rectifier so the voltage will likely read 3+ volts less than the input voltage. This is normal for DC voltage on a bridge rectifier.

Inputs Tab

The inputs tab will allow you to define up to 8 inputs. These inputs each have a jumper setting that must be set prior to configuring them in REM. They can be configured as 10k or 1k thermistor, 0-10v signal, or dry contact inputs. image

  1. 10k or 1k thermistor: You can hook a 10k or 1k thermistor directly to the input contacts. First configure the jumper to the proper position then click on the gear icon for the input and configure it as you see below. The input will read in kiloohms and should be fed to a generic device created on the Generic tab in REM. Refer to the Thermistor setup instructions for setup.

image

Once you have started receiving data from the input in the form of kOhms of resistance, as displayed on the input you need to configure a generic 10k Thermistor device. Refer to the 10k Temperature Probe section to set this up and come back here to set up a feed to the generic 10k Thermistor device. The generic device will convert this resistance value into temperature for you.

Once you have created your generic Temperature probe come back here and set up a feed from the MEGA-BAS input to the sensor.

Navigate to the Feeds tab on MEGA-BAS Device you created under the I2c Bus #(x) tab then Click the + on the Device Values Feeds list. This will open up a dialog that will allow you to easily send the information to your 10k Temperature Probe device.

image

Select Internal Devices from the Connection Dropdown and the dialog will change to allow you to enter the other required information. Next select the Send Value. This should be one the 0-10v in #(x) value options where x is equal to the input number connected to the probe. IMPORTANT: Make sure you select the option that ends in value. The other options send more information than the Generic probe is expecting.

Leave the Sampling at 1 for now but if the probe reads erratically you can increase the sampling number to take several reads then choose the median value to send to the Generic device.

From the to Device dropdown select the generic 10k probe you created earlier. The Input should be set to adcValue.

image

When you have completed entering the information press the Save button and it will add an entry to the Device Feeds list. Go back to your Generic probe and you will see that it is converting the resistance reading from the MEGA-BAS input into temperature.

  1. Dry Contact: A dry contact sensor is on where the sensor reads that the connector is shorted between the contacts. If it is shorted the input will read with a green light on the sensor display after it is configured. Set the jumper for the input connector to the center position and define the input using the gears icon as a dry contact Input Type.

image

RS-485 Tab

If you are using the MEGA-BAS card to control RS-485 devices such as chlorinators, variable speed/flow pumps, or other devices change the Port Mode to RS485 Pass Thru. This will change the transceiver on the MEGA-BAS to a serial RS-485 device connected to one of the comm ports on the Raspberry Pi.

To enable the Raspberry Pi to use the serial port you will need to change the configuration. Either enable the Serial Port interface from the UI at Preferences --> Raspberry Pi configuration or use raspi-config from the command line. Enable the serial port in either place then reboot the pi. Also make sure you have the Serial Console disabled as this will interfere.

image

Once you have enabled the serial port it should show as ttyS0 by running the command ls /dev/ttyS0 this will also be the port name when referencing the RS485 port.

If you are intending to use the port as a MODBUS slave then use the MODBUS RTU setting. From there you are on your own but essentially it will allow you to treat the MEGA-BAS as a MODBUS slave. Refer to the Sequent documentation of available control sequences.

Sequent Relay Hats

Sequent Relay Hats can be setup using the Multi Relay Board option.

Sequent 8-Relay Hat Reset Button

This button is pre-wired to GPIO26 (Pin#37). You can enable this GPIO input pin but if the state is not triggered, you need to tell the O/S to set the internal pull-up resistor.

To do this, add the following line to /boot/config.txt.

gpio=26=ip,pu

You can find a handy script to monitor and shut down the Pi at Sparkfun. (And if you think this should be enabled through REM, open an issue or complain about it on the Gitter forums.)