AdSense

Wednesday 21 August 2013

Arduino as logic analyzer

As promised in my "Home Automation" postings I am going to explain how to use your Arduino Uno as a logic analyzer.

Firt of all you have to download the required software für the Arduino. it can be found here. Depending on the sampling rate you need (2/4 MHz or 1 MHz) you have to choose the correct sketch and upload it to your Arduino. You also have to download the file "ols.profile-agla.cfg" - we will need it later.


After having uploaded the sketch to the Arduino, you can start the serial monitor, switch to 115200 Baud and send 1 or 2 via serial connection to your Arduino. If you receive some kind of status report, everything works fine.


For the next step we will need a software which displays the logged data on the computer. We will use the tool "Logic Sniffer". It's written in Java, so it can be used with Windows and Linux. Download the latest version and unzip it. Copy the file "ols.profile-agla.cfg" to the folder "plugins" and start the programm with "run.bat" or "run.sh". 

You should see the user interface:
Click "Capture"-"Begin capture" - the following window is opened:
Here you have to set the COM-Port of your Arduino, set the correct baude rate and choose Arduino as "Device type". Click "Show devive metadata" to see if everything works as planned.
In the tab "Acquisition" you can set details like sampling rate and so on.
In "Triggers" tab you can enable the triggers. If you tick a channel in "Mask" row, it will be started by a trigger. If "Value" is ticked, it will be triggered by a HIGH signal, otherwise a LOW signal. With "Before/After ratio" you can decide which period before and after the trigger is logged. In the example we will log 5% of the time BEFORE and 95% of the time AFTER the trigger signal.

Now you can connect the signal you want to analyze to the Arduino. Channel 0 is connected to pin 8, channel 1 is pin 9 and so so. 6 channels are supported.


When everything is prepared, you can click the "Capture" button. You should see your signal on the screen:

Of course this logic analyzer isn't as good as the "big" (and expensive) ones. The biggest problem is the limited memory. Only short signals with low sampling rates can be analyzed. But for small projects it should be enough.

No comments:

Post a Comment