Making a circuit that "remembers" a dip in voltage

Hi all,

I'm a beginner so please bear with me if I use terms incorrectly. I would like to build a circuit that will remember if a voltage of an input signal has dipped below a threshold. I have an input signal that normally has a voltage of 5v that at times momentarily drops to about 0.

I want to make a circuit that takes my signal as input and outputs 5v until the input signal drops below 2.5V. Then I want the circuit to output 0V, even if the input returns to a higher voltage. It would also be fine if it returns to the higher voltage but much more slowly.

Is there an official name for this type of circuit? Thanks for any advice!! :)

Read up on comparators and call us in the morning... http://en.wikipedia.org/wiki/Comparator

Oh, and read your manual for your Atmel Chip and see if you have a differential comparator on board.

Awesome. Much thanks for the reply. :)

Using arduino you can program "attachInterrupt" to capture falling edge. Than arduino could keeps this "events" in memory as long as necessary, or till you clear it's via serial terminal. May be after some times 5 minutes, few hours using countdown timer.

While many are willing to help out with your specific question, it might be better to explain why you are doing this.

Can’t capacitors read voltage?

Caps know how to store, not read.

No not in the way you might think Read about it… <http://arduino.cc/forum/index.php/topic,114925.0.html > You’ll come away a brighter person

Doc

I’d be happy to. I am using an Arduino Uno to collect sensor data and send it to a host via USB where I record the results in MATLAB. Collection must stop when the Arduino receives a MIDI note-on message from an electronic keyboard. MIDI is a serial communication protocol that is received via this midi interface. In this thread I was very helpfully informed that I can’t use the serial port to both receive incoming midi messages and communicate with a host.

Now I want to use one of the digital inputs to detect the MIDI event. The MIDI input voltage is constant +5v when there is no message, and each message starts with a zero voltage. However, I have observed that often the digital pin does not detect the 0 voltage and I believe this is because the sampling is not in sync with the incoming MIDI signal which is at 31250 baud. So I want to make that first 0 voltage last longer so that it is guaranteed to be sampled.

What do you think of my reasoning? Is there a better approach? Thanks for your interest!! :slight_smile:

brownerthanu:
I was very helpfully informed that I can’t use the serial port to both receive incoming midi messages and communicate with a host.

You can if you use the Leonardo which handles USB host communications without impacting the USART. You could also use the MEGA which has a couple of UARTS.

wanderson:

brownerthanu:
I was very helpfully informed that I can’t use the serial port to both receive incoming midi messages and communicate with a host.

You can if you use the Leonardo which handles USB host communications without impacting the USART. You could also use the MEGA which has a couple of UARTS.

These are great recommendations, thanks. I checked out both and they seem like good options. However, I’m not sure that I can get approval to buy a new board from the folks who control the purse strings around here (grad school). I’d like to use the Uno, if possible.

What about softserial? http://arduino.cc/en/Reference/SoftwareSerial You could wire up your midi incomming signal to any pin. What they say (have no experience myself):

NewSoftSerial is the latest of three Arduino libraries providing “soft” serial port support. It’s the direct descendant of ladyada’s AFSoftSerial, which introduced interrupt-driven receives – a dramatic improvement over the polling required by the native SoftwareSerial.

With Interrupt functionality you should be fine with quick response to midi triggering events.

That looks very promising. I'll try it out today. Thanks! :)

Works like a charm. Just one concern: I'm timestamping data that is being received on the other pins. I want an accuracy of 0.1 ms. Do you think the interrupts used by the software serial will interfere with this at all?

Yes, software serial will interfere with timing. I just check into their “internals” anf find this function:

    // Read each of the 8 bits
    for (uint8_t i=0x1; i; i <<= 1)
    {
      tunedDelay(_rx_delay_intrabit);
      DebugPulse(_DEBUG_PIN2, 1);
      uint8_t noti = ~i;
      if (rx_pin_read())
        d |= i;
      else // else clause added to ensure function timing is ~balanced
        d &= noti;
    }

    // skip the stop bit
    tunedDelay(_rx_delay_stopbit);
    DebugPulse(_DEBUG_PIN2, 1);

Function is blocking , it means till full 8-bits character completely processed, no new interrupt would be served, which in next term means you will have a gap in timestamping depends on baudrate softserial. 32 kbps / 8 = 4 kbyte / sec, or about 0.25 millisecond.

I think that I can work with that amount of delay, for now. I'm extremely impressed by the helpfulness on this discussion board. Thanks! :)