I was planning to make a super simple logic probe but Jon beat me to it with his comparator based logic probe. So I've prototyped a microcontroller based one.
Microcontroller based logic probe with display
My project has just two modules, an Arduino clone and an Adafruit I2C LED backpack. The probe is connected to an analogue pin although the current software uses it as a digital pin only. The pin is sampled once every half second and 8 samples are shown across the screen on the first 2 lines.
I tested the LCD with the Adafruit demo followed by writing my own hardcoded bitmap.
Code
The setup sets the pins, then clears the display and sets the brightness. In the loop it takes a sample, mirrors it to the pin 13 LED and then updates the display.
#include <Adafruit_LEDBackpack.h> #include <Wire.h> #include <Adafruit_GFX.h> Adafruit_8x8matrix matrix = Adafruit_8x8matrix(); int sampleNo; bool samples[8]; void setup() { Serial.begin(9600); Serial.println("Logic Probe"); pinMode(A1, INPUT); pinMode(13, OUTPUT); matrix.begin(0x70); // pass in the address matrix.clear(); matrix.setBrightness(5); matrix.writeDisplay(); } void loop() { samples[sampleNo] = digitalRead(A1); // read the input pin digitalWrite(13, samples[sampleNo]); // sets the LED to the input value writeDisplay(); sampleNo = ++sampleNo % 7; delay(500); } void writeDisplay() { matrix.clear(); for (int i=0; i <= 7; i++){ matrix.drawPixel(i, samples[i], LED_ON); } matrix.writeDisplay(); }
Libraries
https://github.com/adafruit/Adafruit-GFX-Library
https://github.com/adafruit/Adafruit_LED_Backpack
Improvements?
There seems to be a power issue where the Arduino resets when the display refreshes. That was the case with the demo as well as my test code. Potentially a big capacitor across the power rails might fix that or perhaps an independent supply for the display.
It should be possible to update writeDisplay so that the signal scroll across the screen, it would also be good if it used more than just the first two rows on the display.
The other obvious thing to try would be to write the data from the input back to the serial port then have a graphing tool on a host PC to display or capture the waveform.
Top Comments