This is SirProbe, a digital probe to help you debug your circuits. This bot is quite particular, as it's standalone: this is not an extension board. Acutally, the only board is very closed to the main board, just added probe connectors and made it smaller. So, what is SirProbe for ? SirProbe can help you debug your circuits/boards, by recording the logical levels (high or low).
Please note SirProbe is mainly inspired from the Great Bert's digital probe. So, greetings :)
Diving into the MIC800
As a practical exercice, let's have a look at the MIC800 chip and see how does it do its job. The MIC800 is servo controller chip. As every servo controller, it needs to send pulses, at regular intervals (as described here). Using SirProbe, we should be able to view those pulses.
A servo controller board, MIC800 based, is available in the SirBot modules. We'll use it to test SirProbe. While we order a servo to move at a given position, we launch a SirBot console, get a probe object, and record the logical levels sent by the MIC800 chip. Here's the whole thing:
The recording is actually done in a background thread. When we start_record, SirProbe gets the logicals levels. Those are sent by the probe board: "0" for low levels, "1" for high levels... All received levels are timestamped and put in the recording. The save_as method dumps the result in a file, easy to use with gnuplot. There's no friendly GUI for the moment... As soon as I'll get pyqwt working, I'll do it :)
During this recording, we get 297 651 levels. Let's see how they look like. The following diagram shows the complete recording. We can clearly see when the probe's been connected to one the MIC800 output, and it's been deconnected.
Zooming in the graph shows nice results, and gives first hints of how the MIC800 works (well, we actually have a pretty good idea of how it works, that's just checking...). It sends pulses every 15ms and every 35ms (pulse, 15ms, pulse, 35ms, pulse, 15ms, pulse,...). From what can be seen on Internet, 20ms should be the maximum time between pulses. But it seems 35ms is ok.
How large are the pulses ? It depends on the position of the servo. For the MIC800, the position ranges from 1 to 128. This is translated into pulses of 0ms to 2ms. The following diagrams show pulse widths: on the left, position is 1, on the right, 120.
- on position 1, the pulse's width is 0.4ms (approx 0ms)
- on position 120, the pulse's width is 1.37ms
While 0.4ms is ok for position 1, 1.37ms seems to be too small, as the max position is 128, and its corresponding pulse's width is 2ms. But that's theory... I think it depends on the servo's specs.
Anyway, using SirProbe, we can "see" all those logical levels, and have a pretty nice idea of what's happening. SirProbe still misses a nice GUI, easy to use, since the data exploration is painful. Maybe for the next release :)
How many logical levels can SirProbe record ? What's the accuracy ?
SirProbe uses the built-in usart of a PIC 16F638 microcontroller. Each time it sees a high level, it send the char "1", else "0". So the accuracy is linked with the number of chars it can send, that is the baudrate. Here, it's set @ 115 200 bds, the max it can handle (actually it could do 1 250 000 bds, but this baudrate is invalid for the PC. I think it's because the serial controller can't handle it).
So, 115 200 bds is approx 1 char every 8.7µs, in theory. In practice, the min. resolution is 1 char every 50µs. So:
20 000 recorded levels / second
That's pretty good ! Now, there's a little problem... I must admit... Actually, there are holes in the recording, as shown in the following picture.
Those holes appears at frequent intervals. When timestamps are computed, it occurs a kind of delay, thus a loss while getting chars from the board. This is a defect...
Also careful with the memory usage. As the recording can be huge, the memory can get big. This is one of the reason why SirProbe doesn't use the Request/Response objects, usually provided by the libraries.
Anyway. Even with this bug, SirProbe can still help you find out why your GP2D02 IR ranger does not work (this is my next goal).