I have now produced a 3D printed case for the battery hack for the protoboard to make it look a bit prettier. It isn't brilliant but after some fettling I managed to get it all to stick together. And, it still works as well, despite some rather rough handling as I squeezed it all into a slightly too small case - I'm still not leaving enough internal space for the wires.
To be useful as a portal prototyping board there really needs to be some sort of digital meter. I could just carry around a low cost DVM but where's the fun it that so I decided to hack my previous Tiny DVM (TinyDVM#4 : Graphical Display ). I'm not entirely sure whether this counts as a proper hardware hack, or even a hack at all, but I've decided to include it. The original TinyDVM used a MKR 1000 as the controller as it was the only 3.3V device I had that was compatible with the 3.3V OLED display. For this implementation I wanted to use a Nano rather than the MKR 1000 as it was smaller and better suited to the available space on the protoboard. I had previously purchased several 5V OLED displays with an I2C interface (to be the eyes for my walking robots) which I wanted to find out more about so I decided to use one of those. It all became a bit more difficult than I imagined as I had considerable difficulty getting the Nano to control the 128x64 OLED display. This was a clone display using the Adafruit libraries and it just would not work at all. Eventually I found a YouTube video that provided a working solution - sort of - using a Nano and this display. The basic problem seemed to be that the SCL and SDA lines needed pull-up resistors to Vcc and this took me several days to determine. The display would update on the top 20% but the rest would just be noise. The circuit diagram is pretty simple and is shown below. The power will be provided directly from the battery beneath the protoboard although it is not yet connected.
I had hoped to just take the original TinyDVM code and port it to the Nano. Regretfully this was not possible as I had used a mixture of GFX graphics library commands and commands native to the original 64x64 OLED display. Obviously the native commands did not work with the new display but eventually I managed to find GFX commands that would do what I wanted and now have a working version of the even tinyier Tiny DVM. See the important part of the code below.
TinyV = 0.0;
value = 0;
x = 0;
y = 0;
colour = 0;
for (y=0;y<displaywidth; y++)
yarray[y] = 0;
while (1)
{
display.setCursor(90, 50); // Output the analogue voltage - bottom right
display.fillRect(90, 50, 30, 8, 0); // Clear previous value
value = analogRead(0);
TinyV = (5.0 * value)/1023;
display.setCursor(90, 50);
display.print(TinyV,2); // Print a float
display.print("V");
// Erase the previous point
colour = 0;
display.drawRect(x, yarray[x], 2, 2, colour);
// Add the new point
y = 47 - ((47 * value)/1023);
yarray[x] = y;
colour = 1;
display.drawRect(x, yarray[x], 2, 2, colour);
display.display(); // Draw the new point
delay(50);
x = x+1;
if (x > displaywidth-1)
x = 0;
} /* while */
I think that this version of the Tiny DVM programme is better than the original version and is definitely more compact (Tinyier!). It does work, displaying both the voltage numerical as well as a time related graphical display as well. There is some problem as the display will occasionally freeze and then a reset is needed. I think this may be something to do with the I2C interface, perhaps when there is some noise on these control lines.
I wanted to create a 3D printed case for this new Tiny DVM to match the other parts of the Battery Hack Protoboard but regretfully I was unable to complete this - time just ran out and I made a mistake measuring the width of the Nano board with my micrometer. I did manage to print the bottom part of the case as illustrated below. The top part and final wiring will just have to wait until another day.
I'm generally pleased with how it has all turned out and I think this will be a useful system - I have already used it several times. As the Nano in the Tiny DVM is still programmable I might even look into more possibilities of using the graphic display, maybe some sort of low frequency digital oscilloscope. Who knows!
Dubbie
Top Comments