MicroView Gauges

kr

Introduction

The MicroView has a dial-type gauge that can be implemented in two styles – larger and smaller.  This project is an adaptation of Project 003 which also used a potentiometer to demonstrate the MicroView sliders.

Parts
(Please see below for general breadboard arrangement and pin allocations)

Potentiometer:

  • left pin to 0V
  • centre pin to MV pin6
  • right pin to 5V

Breadboard Setup

kr

MicroView Arduino Code

#include    // include MicroView library

MicroViewWidget *widget;  // create widget pointer
MicroViewWidget *widget2;  // create widget pointer
MicroViewWidget *widget3;  // create widget pointer
int sensorPin = A1;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup()
{
digitalWrite(sensorPin, HIGH);  // Internal Pull-up
pinMode(sensorPin, INPUT);   // make pin as INPUT
uView.begin();      // start MicroView
uView.clear(PAGE);     // clear page
widget = new MicroViewGauge(15, 25, 0, 1024); // make widget as Gauge
widget2 = new MicroViewGauge(48, 25, 0, 1024); // make widget as Gauge
// widget3 = new MicroViewGauge(30, 23, 0, 1024, WIDGETSTYLE1); // make widget as Gauge STYLE1
uView.display();     // display the content in the screen buffer
}

void loop()
{
sensorValue = analogRead(sensorPin); // read sensorPin
widget->setValue(sensorValue);   // set value of sensorPin to widget
widget2->setValue(sensorValue);   // set value of sensorPin to widget
// widget3->setValue(sensorValue);   // set value of sensorPin to widget

uView.display();      // display the content in the screen buffer
}

What Should Happen

Widget and widget1 implemented (widget3 commented out, as above).  Both widgets showing the value from 0-1023 as derived from the analogue input on MV pin 6.  0V corresponds to a readout of 0, and 1023 corresponds to a readout of 1023.

kr

Widget3 implemented (widget and widget1 commented out).

kr

Project Notes and Comments

  1. Small Gauges
    Widget and widget 1 are the default, smaller gauges.  Note that it is possible to get two of these side by side using x value offsets of 15 and 48.
  2. Large gauge.  Widget3 is setup with WIDGETSTYLE1 and is the large option.  Both x and y offsets are designed to keep it in the middle of the screen.
  3. A great display for such a small screen, and still space for labels and graphics too…
  4. For future versions, it might be good to have either style implemented as just a semi-circle to save a little screen real-estate.

Breadboard Arrangement and MicroView vs Arduino Pin Allocations

MicroView_pins
Courtesy 0f Geek Ammo

Positioning of MicroView on Breadboard (for my projects at least!)

I have positioned the MicroView at the extreme left of the breadboard as this allows it to be plugged directly into my laptop, so as not to need flying leads etc.  Also, the first 8 pins of the MicroView correspond properly with the numbered breadboard sockets.  This is different from the (excellent) Geek Ammo training tutorials.

  • Pin 1 of the MicroView is in breadboard socket C1.
  • MV pin 8 (GND) is used to ground the breadboard 0V rails.
  • MV pin 15 (5V) is used to power the breadboard supply rails.

kr kr

Acknowledgments
All code inspired by (and possibly modified from) the MicroView tutorials from the great team at Geek Ammo.  Visit their MicroView Kickstarter page.  Big thanks!

Advertisements

5 thoughts on “MicroView Gauges

  1. Is there a way of adjusting the range of the value displayed? I’m looking to achieve a displayed range of -100 to 100.

    Thx.

  2. So this is a while ago, but as I recall the scale is specified when the gauge is created. The reference page is at http://learn.microview.io/doco/html/class_micro_view_gauge.html. It’s the last two numbers in the arguments provided, the first two being the x and y location. So to create a gauge at co-ords (15,25), the code for you might look like:

    widget = new MicroViewGauge(15, 25, -100, 100);

    Now I’ve not tried this, and if the -100-100 range throws an error, the simple solution is to map your -100-100 range onto the 0-1024 range of the gauge before displaying.

  3. Thanks. I had tried altering the range but that wasn’t working. I’ve since found my error was in not converting sensorValue into a display value and then inputting that into the gauge. (You can tell I’m new at this, eh?)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s