Last Update: 09/24/2013
Status: Done
Github:
https://github.com/baldengineer/Mixed-Signal-Oscilloscope-Demo-Board
Abstract
As a member of the TechShop in Austin, TX I teach a class on Electronics Measurements. The class includes a variety of test equipment like power supplies, DMMs, and Rigol oscilloscopes. One of the oscilloscopes is a Rigol DS1052D which is a “Mixed Signal Oscilloscope.” In addition to the two 100MHz analog channels, the scope also include 16 digital channel channels. It is a logic analyzer and oscilloscope in one!
To demonstrate how the digital signals work, I created this demonstration board to use during my class. The idea is that it acts like a simple counter. When you press the mode button, an “error” is introduced on one of the channels–a bit gets stuck.
Electronics
The board is based on an ATmega328p. Unlike an Arduino, this board does not have a usb to serial chip or a voltage regulator. So it must be programmed over ICSP or with a FTDI chip (assuming the ATmega328p is programmed with the Arduino bootloader.)
There are 8 LEDs with current limiting resistors connected from D2 to D9 (arduino numbering). D13 has an LED. the push buttons are connected to A0, A1, and A2 with the expectation to use internal pull-ups. A3 is connected to another LED labeled “Mode”, which can be used to indicate when the error is enabled.
Schematic
The full schematic is available in the Github directory as a SCH file.
PDF of the schematic:
MSO-demo-board r1
Firmware
#define ON true
#define OFF false
byte counter=0;
int delayTime = 50;
boolean enableError = false;
boolean errorRunning = false;
boolean errorState = OFF;
boolean displayError = false;
unsigned long incrementCounter = 0;
unsigned long errorTimeOut = 100;
unsigned long endOfError = 0;
boolean showNewTime = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
for(int i=0; i<8; i++)
pinMode(i+2, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
while (Serial.available())
processSerial();
if (showNewTime) printTime();
if ((unsigned long)(millis() - incrementCounter) >= delayTime) {
counter++;
// incrementCounter = millis() + delayTime;
incrementCounter = incrementCounter + delayTime;
}
checkError();
if (displayError) bitWrite(counter,1,1);
for(int i=0; i<8; i++) {
digitalWrite(i+2, bitRead(counter,i));
}
// delay(delayTime);
}
void checkError() {
// if the global enable is off, don't do anything.
if (enableError == false) {
displayError = false;
return;
}
digitalWrite(13, errorState);
if (errorState == ON) {
// leave the bit high for errorTimeOut
if ((unsigned long)(millis() - endOfError) >= errorTimeOut) {
// it's done
errorState = OFF;
endOfError = endOfError + errorTimeOut;
displayError = false;
}
} else {
// leave the bit low for errorTimeOut
if ((unsigned long)(millis() - endOfError) >= errorTimeOut) {
// it's done
errorState = ON;
endOfError = endOfError + errorTimeOut;
displayError = true;
}
}
}
void printTime() {
Serial.print(delayTime);
Serial.print(" - ");
if (enableError)
Serial.print("Error On");
else
Serial.print("Error Off");
Serial.println();
showNewTime = false;
}
void processSerial() {
int incoming = Serial.read();
if (incoming == '!')
enableError = !enableError;
if (incoming == '+')
delayTime += 10;
if (incoming == '-')
delayTime -= 10;
if (delayTime <= 0) delayTime = 1;
if (delayTime >= 1000) delayTime = 1000;
showNewTime = true;
delay(1); //add a little more time to give another character a chance to arrive.
}
2 Comments
Hello James,
i think this is a nice little project! Unfortunately the Eagle file evokes an error when I try to view it or to upload i into any pcb-manufacturer production webinterface.
Can you upload a new more recent version of the Eagle file?
regards
reeder76
Sorry. I stopped using EAGLE in 2015 or 2016. I don’t have it installed anymore (and I never plan to use it again.) Back when I made the design (10 years ago?) I was probably using EAGLE 6. Maybe you can find an old binary from back then. Or KiCad will probably import the files.