pfc8583 counter / clock chip

HydraFerret: Multi-sensor IOT with a simple interface.


↓↓ Dig deeper ↓↓


Introduction

This device acts as a high speed counter (up to 1MHz) with a maximum count of 1,000,000. In theory this should permit the counter to be used with an ultrasonic sonar to give millimeter perfect distance readings. However, in practice some variation will be observed, and some sonar devices may be more consistent than others.

there are a number of different sonar designs that can be used with Hydraferret, all using the same principle of operation. This is true for units with separate transmit and receive sensors or a combined one or weather proof ones. If installing into a damp (or potentially damp/humid) environment be sure to select a sonar with sufficient weather proofing.

Measuring distance using the pfc8583 counter works as follows: wiring diagram for distance measurement

  1. At the start of the measurement period a short pulse is sent on the "trigger" output, which is the sonar's trigger input. This signals the start of distance measurement.
  2. The sonar will send a sonic "ping" on it's transmit output, and the "echo" output will go high
  3. The sonar will wait for the "pong" to be returned, and once received the "echo" output will go low again
  4. By "AND"ing the output of an oscillator and the "echo" output and using this as a counter input on the pfc8583, the number of pulses counted can be used to determine the sonar distance.

In many Arduino distance measurement sketches the processor clock cycles are counted for the duration the "echo" output is high and this is multiplied by an approximate speed of sound. This approach has not been taken for the HyraFerret project for the following reasons:

Configuration

The minimum configuration is to simply added the sensor and restart the esp32. The configuration of the I2C bus is discussed elsewhere on this page. Each pfc8583 should have unique address on the bus on which it is located. The pfc8583 devices are numbered 0 to 4, starting with units on bus 0 then bus 1. On each bus the number allocation is in device address sequence.

When using for distance measurement a maximum oscillator frquency supported by the pfc8583 is 1MHz. A logical AND can be done using one part of a CMOS 4081, or half 4011 or using 2 diodes and pull up resistor. When using a diode AND, the cathodes (negative side) face the osciillator and echo outputs. The anode (positive sides) are tied together and have a pull up resistor. The anodes then provide the ociillator input to the pfc8583. If using a CMOS device as an AND gate, tie any unused inputs to ground.

An oscillator chip such as MCO-1510A can be used to give an accurate pulse source. This oscillator is a 4 pin device in a 14 pin DIP package profile and has ground connection to pin 7, output pin 8, and 5V to pin 14.

Configuration commands are:

critical|extreme|warning pfc8583 <0-1> var disable
critical|extreme|warning pfc8583 <0-1> var <rpn-expression>
    enable or disable alerting thresholds on sensors

devicename pfc8583 <0-1> <device-name>
    Name a sensor device

[enable|disable] [showlogic]
    Enable or disable display of rpn logic for alerts

frequency [pfc8583 <n> <frequency>]
    Set reference frequency in Hz for time dependant measurement
    Use frequency of 1 for counter, and 0 for non-resetting counter
    eg if using 1MHz osc for distance measurement, frequency will be 1000000

i2c [<0-1> <sda> <scl> [speed]]
    Set i2c pins, eg: 21 and 22 for bus-0, and 5 and 4 for bus-1

interval pfc8583 <1-300>
    Set the interval between measurements taken by the sensor.

remove pfc8583
    Remove all discovered pfc8583 devices from monitoring cycle
    NB: Removal does not persist after reboot.

rescan pfc8583
    Rescan i2c busses for added or removed devices of specified type.

transform [pfc8583 <n> <rpn-formula>]
    The transform formula is applied to the "xfrm" variable each measurement interval

transformname [pfc8583 <n> <name>]
    Apply the name to a transformation

trigger [pfc8583 <n> <pin>>]
    Use the specified pin to generate a short trigger pulse at the start of pfc8583 measurement
    Typically used for start of ultra-sonic measurements

rpn variables:
    pfc8583.dev  - count of pfc8583 sensors (DEVice count)
    pfc8583.freq - frequency of oscillator to use for distance calculation
    pfc8583.pin  - Trigger pin number
    pfc8583.coun - Count as a the last 5 minute interval
    pfc8583.lasc - Last count
    pfc8583.dist - Average measured distance in cm over 5 minute period
    pfc8583.lasd - Last measured distance in cm
    pfc8583.xfrm - result of transform calculation (if defined)
    pfc8583.csta - 0=OK, 1=warn, 2=critical or 3=extreme status

Other Notes




Thank you for visiting this websiteHome