Viewing 0 reply threads
  • Author
    Posts
    • #11333
      Michel Castaño
      Keymaster

      Syrus 4G counts with 2 analog-to-digital converter pins: Wires white and pink in the 16 pin Molex harness.

      Any of them are high impedance analog Inputs (128 Kohms) able to measure voltages between 0V and 28 VDC.

      For this tutorial we are going to read the Power Source’s voltage using Analog Input 1 (White wire) and to add it inside a reporting position frame to Pegasus, so we could have this value every 2 minutes.

      First, Connect white wire to +V and brown wire (Syrus’ Ground) to the voltage to be measured. For this example black wire is already connected to Power source’s ground so we can omit connection of brown wire.

      We can see immediately the Voltage read from power source in the User Interface -Inputs/Outputs Section:

      Compared with a Multimeter read it is very precise:

      This value can be consulted via API and via APX core.

      Via Apex:
      sudo apx-io getall analogs

      Via API

      http://192.168.39.173/IO/all

       

      Now that we are pretty sure we are receiving Analog readings from our Analog Input 1, let’s create some Syrus JS commands

      For this Small forum post we are not going to dive deep into Syruslang language, to do so visit our complete documentation here, instead, we are going to touch the main  Syruslang commands we need to generate a report every 2 minutes including Analog Input 1 Information.

      We must define a set of fields to be reported (Fielsets), Signals to trigger actions “start” and “stop” timer, and a reporting event.

      #Define a Fieldset including ADC Values (Fields come from “Device Components” Section in Manual
      define fieldset default fields=$io.an1,$io,$gnss,$net,$accelerometer,$ecu,VO:$counters.globals.odometer,CE:$counters.globals.ignition_time,CL:$counters.globals.idle_time,CS:$counters.globals.over_speed,CR:$counters.globals.over_rpm

      #Signals to trigger and stop Actions related with Timer
      define signal ignitionON min_duration=5s $io.ign == true
      define signal ignitionOFF min_duration=5s $io.ign == false

      #Define ADCTimer
      define timer ADCtimer duration=2min repeat=true enabled=true

      #Define Actions to start and stop Timers
      define action start_ADC_measures trigger=ignitionON, start timer ADCtimer
      define action stop_ADC_measures trigger=ignitionOFF stop timer ADCtimer

      #Define Event to report position with ADC every 2 minutes
      define event ADCReport group=tracking fieldset=default ack=seq label=adcread code=53 trigger=@timers.ADCtimer

       

      Now ADC is shown in real time in Pegasus’ Tracking module

      Also Detailed ADC voltage can be seen in rawdata:

Viewing 0 reply threads
  • You must be logged in to reply to this topic.