Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: 24Vdc Analog data logger 200hz - Has someone already done the work for me.

  1. #1
    Senior Member
    Join Date
    Feb 2016

    24Vdc Analog data logger 200hz - Has someone already done the work for me.


    I have an issue at work with a safety controller that is going into an undocumented fault state.
    Its a little yellow module that monitors a few e-stop switches and opens a set of contacts when the e-stop contacts are open, or shorted.
    The problem is when I'm called to look at the fault I arrive to the controller in an impossible state (power,in1,in2,reset indicating lights on but Out light and fault light off).
    Click image for larger version. 

Name:	1.jpg 
Views:	21 
Size:	60.9 KB 
ID:	13553
    I finally had an excuse to pull out a teensy3.2 , and with a transistor and resistor created a device to open a channel for pot adjustable amount of time.
    I found that I can only put this device (pilz PNOZ S3) in the particular state if I open a e-stop contact for >9ms (anything below is ignored) or <35ms (anything above correctly triggers fault light).
    Click image for larger version. 

Name:	2.JPG 
Views:	18 
Size:	122.3 KB 
ID:	13554
    #include <SPI.h>
    #include <gpio_MCP23S17.h>   
    //define CS pin and using HAEN or not
    //to use HAEN, address should be 0x20 to 0x27
    gpio_MCP23S17 mcp(10,0x20);//instance (address A0,A1,A2 tied to +)
    void setup(){
      mcp.begin();//x.begin(1) will override automatic SPI initialization
    uint32_t potValue=0;
    #define TEST_TIME 2000
    elapsedMillis testTime=0;
    void loop(){
        Serial.print("open circuit for : ");
        Serial.println(" Microseconds.");
        uint32_t tempTime=micros();
        {}                                  //delay for uSeconds set by pot.
        Serial.println("circuit closed again");
    The only data logger we have at work has a 25hz refresh on a few analog signals so wouldn't even catch this condition.

    I doubt I'll need it for this issue , but I am interested in building a "glitch catcher" that would need to monitor 24vdc signals and log data at a high enough rate to capture this type of issue.
    I've been thinking and I only ever need low resolution data (maybe 8bit 0v - 25.5vdc at .1v steps) and would only need to timestamp log when data changes by .1Vdc.
    I think a 1Mohm voltage divider with 3.3V zener diode at the teensy input to protect from spikes?
    Maybe a simple voltage divider with zener for supplying power to teensy.

    I'm just after some thoughts on what others have done for data logging and some guidance on my teensy protection method or any other issues I might not have thougth of. My electronics is very basic.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    I don't quite understand your question, but I *really* don't understand how your program is logging anything. The only thing I see your code reading is an analog voltage, and you seem to be using it to only change the timing of output pulses to that I/O expander chip. I can't see any way you're actually reading anything at all, much less what could be the cause of only detecting something more than 9ms long (which is pretty much forever for a fast chip like Teensy).

  3. #3
    Senior Member Projectitis's Avatar
    Join Date
    Feb 2018
    New Zealand
    Paul, I think the code is unrelated to the question. The code is to trigger an error condition in the device artificially.
    His question is about a potential project that can record/catch these glitches when they happen naturally, and whether anyone has done something similar before. Just read from after the code example onwards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts