A Max Hold Circuit

Since the conversion rate on the MSP430 would not reliably see my piezo sparks, I decided to try my hand at a max hold circuit. I considered using a simple RC circuit to try to capture and stretch out the pulses, but this seemed to be outside the scope of what I could reasonably do.

A few hours of Goggling found me looking into Sample And Hold (SAH) circuits. A circuit could be make where the SAH would go into sample mode if the current max value (output of the SAH) was less than the SAH input. The comparison would be done with a comparator. Once the parts came in, I must have played with the circuit for days before I got it to work. I had to properly account for all the logic states and the reset lines.

The one unanticipated benefit of the max hold circuit was I no longer really needed the precision rectifier. I would only capture the positive maximums, but from the data I collected the positive and negative peaks were about the same magnitude. It would gain me little to rectify and max hold both the positive and negative peaks.

Once working the SAH would hold the max value it saw till such time as it was reset by a signal from the micro. So Now I modified my code to sample the ADC and as soon as done to reset the SAH and then start another DAC conversion. I still wanted to convert as fast as possible as the SAH can’t hold a voltage forever and I love lots of data.

Once I got the sample I was going to transmit the data to my Linux box, but I quickly realized that the baud rate of the MSP (9600) was way slower than the rate I was collecting data. I therefore instituted a max hold function in software. After sending out data to the Linux box, I would reset the max value and replace it with larger numbers as they were sampled from the ADC. To cut down a little on redundant data I also implemented a filter that only set out data if it differed from the last data sent out. I also ended up adding a feature to zero out any sample lower than the noise floor. This prevents a continuous stream of ‘fuzz’ with no data in it. The noise floor threshold was determined from collecting several days of no-storm data.

And that is when Murphy came to visit again.

This entry was posted in Lightning detector, Projects. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image