collapse

Author Topic: NanOMeter  (Read 438 times)

Protowrxs

  • Member
  • *
  • Posts: 146
    • The Protowrxs World
NanOMeter
« on: January 01, 2020, 12:59:44 PM »
The NanOMeter
(Pronounced Nan OM eter – Like speedometer of course)
NanOMeter-Main.JPG
*NanOMeter-Main.JPG (189.05 kB . 800x600 - viewed 23 times)
Having historically kludged together a breadboard, or dead bug wired something to simply test an SR04, measure a resistance, or test a servo or stepper driver, I finally decided I’d do something a little more permanent. What trigger this was seeing VolsR’s (https://www.instructables.com/member/VolosR/) little Nano based “semi” multi-meter solution on Instructables.com.

His circuit info wasn’t completely accurate and he has since developed a more advanced printed circuit board version, but there was enough to get me started on putting a little multi function meter / tester together. I followed his basic concept and used his code as the core as it worked well, and then added a few more functions I needed or wanted. I even used his basic layout of his original board as it just worked well.

At this point the little box can:
1) Measure DC voltage (with reverse voltage diode protection),
2) Read an analog input and show the value, as well as the min, max and average values
3) Measure the resistance of a resistor
4) Measure the voltage drop of a diode or LED (and test the LED there too)
5) Act as a beeping / LED continuity tester
6) Generate a PWM output
7) Test a servo
8 ) Test a ping / SR04 sensor
9) Drive a stepper motor
10) Monitor the external battery supply voltage on the Vin pin
11) Allow adjustments to the data dump timer (more later)
12) Do an I2C bus scan and show attached device addresses.

Additionally the device is outputting data for the current mode to the serial port (USB or TTL) that can be used to log sensor data over time. It can also be minimally controlled over the serial port with mode toggle or selection, PWM width change, servo pulse changes, and logging time period changes. The data is dumped in a CSV format with the mode name, millis(), data1, data2, data3, data4 format. Using the millis() value one could time chart the data if desired. You could also use a wireless serial bridge such as a 2.4G or Bluetooth version and log that data back remotely as well I guess.

The I2C bus is exposed next to the display but at this point the Nano is at 99% of memory used on my compiler (30624 or 30720 bytes), so there is not much room for growth. Your compiler mileage may vary. I’m compiling under Arduino 1.8.7 on Ubuntu 18.04 with the Adafruit 1.0.0 SoftServo library and the 1.1.3 Stepper library. You can comment the “useFonts” #ifdef to remove the font usage and use the normal text scaling instead. It does save quite a bit of space.

Unfortunately the libraries, along with the fonts, eat up a lot of memory on the device. The images do not make any difference so removing them doesn’t help a lot. One could remove the fonts and have more programming space if desired I think. Only 69% of the dynamic memory is being used so I do not believe there will be any stability issues. Obviously the code could be optimized but I’m pretty done with it at this point. In reality only the A3 and A6 pins are left to be used so there isn’t much left to work with there either. My code is not pretty nor optimized but it works so I’ll leave it at that.

Current pin uses are:
   (P) = PWM Pin
//  0      - Rx - On header pin lower right - Used to receive commands from serial console, etc
//  1      - Tx - On header pin lower right - Dumps CSV data to here
//  2      - Left Button
//  3(P)- Middle Button (on interrupt)
//  4      - Right Button
//  5(P)- Software Servo Pin
//  6(P)- PWM output on three pin header
//  7      - Ping Trigger
//  8      - Ping Echo
//  9(P)- Stepper IN1
// 10(P)- Stepper IN3
// 11(P)- Stepper IN2
// 12      - Stepper IN4
// 13      - Used for speaker output and LED display
// A0     - Main Analog Input
// A1     - External Battery Power Supply Voltage 100k/10k divider
// A2     - Input for Diode and Resistor testing
// A3     - SPARE
// A4     - I2C bus
// A5     - I2C bus
// A6     - SPARE
// A7     - Voltage Meter input - on 100k/10k divider

I used Adafruit’s SoftServo library as the normal servo library kills some PWM pins and I wasn’t sure if they would be needed. It works well for this use and I’ve used it on other robots as well. The AdaFruit OLED library is used for the SSD1306 device which is the 128 x 32 pixel version. VolsR’s updated version uses the larger 128x64 version but personally I would rather have the board space than more display space for this project.

To add the images I “temporarily borrowed” some icon art from online (I’ll give them back when I’m done) and converted them to the HEX format needed using the handy image2cpp online at at https://diyusthad.com/image2cpp. Works great and good enough results for me.

NanOMeter-Volts.JPG
*NanOMeter-Volts.JPG (66 kB . 672x286 - viewed 23 times)NanOMeter-Analog.JPG
*NanOMeter-Analog.JPG (60.12 kB . 626x266 - viewed 25 times)

The Circuit

I haven’t drawn a full schematic up but each test point is pretty simply. Using the above pin outs one should be able to replicate it. The voltage dividers on the volt meter and external battery are simple 100K / 10K voltage dividers. The buttons simply go from the pins to ground and we use the internal pull up resistors on the Nano. I did not use any pull up resistors on the I2C display and it works fine.  The tiny speaker connects directly to pin13 and to ground. It does show a positive terminal so I connected it like that. The dropping resistor for the diode / led is a 2.2K in mine, just tweak the code as needed.

The Buttons

With only three input buttons there are limits BUT in reality you can get six (6) options out of them at least. The middle button is hooked to an interrupt that toggles the “mode” for the box. The left (down) and right (up) buttons selection options within the modes if there are any, i.e. in PWM they change the pulse widths, etc. Simultaneously pressing the Up and Down toggle the “Pot Mode” allowing a pot to be connected to the analog input to control the PWM, Servo and data dump timer modes. Just makes it easier to test things. Pressing the down and select toggles the beeping sounds on and off, including the continuity mode. In analog reading mode the down button resets the averages.

The Down Sides

There are obviously some down sides to the little box. For one the voltage measurements aren’t the most accurate. I’m not sure if it’s the voltage drop on little 1N914 diode I’m using for reverse protection or something else. I do have an adjustment in the code to offset the diode and it’s accurate at lower voltages but off at higher voltages. I know voltage drop can vary by voltage but wasn’t aware it was that much.

The Conclusion

So far the little NanOMeter has been pretty handy. I’ve built a couple probe wires out of header jumper wires to more easily use the volt meter and continuity tester piece. Also built a header adapter for the analog input and resister/diode/continuity connectors from male headers that can be inserted to flip the gender of the connectors without surgery. I also added an additional header that provides power and ground directly from the battery (7.4v old Canon camera battery) that I can use to power bigger voltage / current requirements without leaning on the Nano’s regulator too much. Great for driving stepper motor controllers and could be used to drive H bridge motor drivers as well.

So if you need a simple voltmeter/analog tester/ohm meter/diode drop/continuity tester/PWM tester/Sevro tester/SR04 tester/stepper tester/data logger/I2C bus scanner, this could be useful.

The NanOMeter now has a prominent place on my bench and is quite handy when I need to check an address on an I2C device, validate a resistor value, test an analog based sensor etc.

I'm sure many here can improve, fix, and enhance this little project!

Cheers – ProtoWrxs
https://www.protowrxs.com/index.php/2020/01/01/nanometer-2020/

*NanOMeter2020.ino

Edit: Remove source in post - It's too big apparently...
« Last Edit: January 01, 2020, 01:52:27 PM by Protowrxs »
The past is done, the future is not here, live today...
My Bots: http://www.Protowrxs.com/robotics

 

* Search


* Recent Topics

NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]


"D" -Pad Workio just like Magic (Will Merlin stay or Go) (part 6 of 7) by Gareth
[December 30, 2019, 09:51:27 AM]


PS4 Joystick Digitals 4,5,6,7,10 - Analog's Lx,Ly,Rx,Ry Workio (part 5 of 7) by Gareth
[December 30, 2019, 09:50:37 AM]


Menu Workio ! (part 4 of 7) by Gareth
[December 30, 2019, 09:49:49 AM]


L1 trigger design Workio (Hori controller) (part 3 of 7) by Gareth
[December 30, 2019, 09:48:50 AM]


Hori aka PS4 Joystick Mappings (part 2 of 7) by Gareth
[December 30, 2019, 09:47:17 AM]


PS4 Single Left-Handed Controller (part 1 of 7) by Gareth
[December 30, 2019, 09:44:58 AM]


Time of Flight >>> Rounded Corners !!! by BaldwinK
[December 04, 2019, 05:46:08 PM]


The unnamed (yet) quatruped spider project by maelh
[December 04, 2019, 08:38:58 AM]


American Civil War Robot by kingart3
[November 27, 2019, 06:39:47 PM]


2D Side Scroller Cyberpunk themed by Killer Angel
[November 12, 2019, 07:56:15 AM]


Ebot SL by erco
[October 31, 2019, 04:27:36 PM]


Discord anyone? by tinhead
[October 20, 2019, 05:35:59 AM]

* Recent Posts

NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Re: Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]


"D" -Pad Workio just like Magic (Will Merlin stay or Go) (part 6 of 7) by Gareth
[December 30, 2019, 09:51:27 AM]


PS4 Joystick Digitals 4,5,6,7,10 - Analog's Lx,Ly,Rx,Ry Workio (part 5 of 7) by Gareth
[December 30, 2019, 09:50:37 AM]


Menu Workio ! (part 4 of 7) by Gareth
[December 30, 2019, 09:49:49 AM]


L1 trigger design Workio (Hori controller) (part 3 of 7) by Gareth
[December 30, 2019, 09:48:50 AM]


Hori aka PS4 Joystick Mappings (part 2 of 7) by Gareth
[December 30, 2019, 09:47:17 AM]


PS4 Single Left-Handed Controller (part 1 of 7) by Gareth
[December 30, 2019, 09:44:58 AM]


Re: Time of Flight >>> Rounded Corners !!! by BaldwinK
[December 04, 2019, 05:46:08 PM]


Investigating the VL53L0X Laser Rangefinder by BaldwinK
[December 04, 2019, 05:35:57 PM]


Re: The unnamed (yet) quatruped spider project by maelh
[December 04, 2019, 08:38:58 AM]


Re: The unnamed (yet) quatruped spider project by Nemesis
[November 28, 2019, 12:58:18 PM]


Re: The unnamed (yet) quatruped spider project by tinhead
[November 28, 2019, 10:09:46 AM]


Re: The unnamed (yet) quatruped spider project by Bajdi
[November 28, 2019, 08:44:38 AM]