Introduction: Wifi Calipers
This instructable is an add on to the common digital calipers that makes them wifi enabled with a built in web server.
The idea was inspired by the wifi interface instructable by Jonathan Mackey https://www.instructables.com/id/Caliper-Data-Inte...
Features of this unit are:
- Add on to back of digital calipers to make series of measurements available over wifi
- Self contained, no extra wires
- Battery powered (rechargeable LIPO); external charging point ; also powers calipers
- Very low quiescent current (< 30uA) for long battery life
- Single button control to power on, take measurements, power off
- Auto turns off if quiescent for a period
- Measurements can be saved and loaded to files containing up to 16 measurements
- Individual measurements can be named
- Status and configuration data also available from web interface
- Software can be updated via web interface
- Initial AP to set wifi access details when first configured or network changes
Step 1: Components and Tools Required
- ESP-12F wifi module
- 3.3V regulator xc6203
- 220uF 6V capacitor
- 3 npn transistors (e.g. bc847)
- 2 schottky diodes
- 6mm push button
- small LIPO battery 400mAh (802030)
- Resistors 4K7,10K,15K,3 x 100K,220K,470K,1M
- small piece of prototyping board
- 3 pin connector for charging.
- Hook up wire
- Enamelled copper wire self fluxing
- Epoxy resin
- Double sided tape
- 3D printed cover https://www.thingiverse.com/thing:3431790
- Fine point soldering iron
Step 2: Schematic
The electronics are fairly simple.
A LDO 3.3V regulator converts the LIP to 3.3V needed by the ESP-12F module.
The caliper has 2 signals (clock and data which are at approximately 1.5V logic levels. These are fed through simple npn transistor stages to drive the GPIO13 and 14 pins at the 3.3V logic levels needed by the ESP-12. Internal pull ups are used as the loads.
GPIO4 is divided down and buffered by n npn transistor to provide power to the calipers.
The push button supplies a high to the EN of the ESP-12 via a diode to turn it on. A GPIO output can then also maintain it high via a diode to keep it on until it is put into a deep sleep state. The button can also be monitored via GPIO12.
Step 3: Construction
The caliper has a simple interface consisting of 4 PC pads behind the small sliding cover on the side.
I chose to connect to these by soldering on enamelled self fluxing copper wires. This gives a reliable connection and allows the cover to be still slid back on to keep it neat. After soldering I used a small smear of epoxy resin as a stress relief on the wires.
In my case the signals were +V, clock,data, 0V reading from left to right, but it might be worth checking these in case it varies with different calipers.
The main effort in the construction involved the regulator and peripheral electronics which I mounted on a small 15mm square piece of prototyping board. I used smd components to keep it a small as possible. This board was then piggy backed onto the ESP-12F module using wires from the board to the power and GPIO pins on the module to hold it in place.
The battery and button and charging point were then wired up. For a charging point I use a 3 pin connector with outside 0V and central charging pin so the polarity doesn't matter. I have a separate USB LIPO charger which I use to charge this and similar modules. I included a simple small plug socket in the battery line inside the module to allow power to be removed if required.
The battery and ESP-12F module were stuck onto the calipers with double sided tape, and the wiring completed. Positioning needs to be done with care as the cover needs to fit back over these and clip onto the calipers. The cover is designed to fit well over the calipers and I use just some tape to secure the cover in place.
Step 4: Software and Configuration
The software is built in an Arduino environment.
- WM_PASSWORD defines the password used by wifiManager when configuring device onto local wifi network
- update_password defines a password used to allow firmware updates.
When first used the device enters wifi config mode. Use a phone or tablet to connect to the Access point set up by the device then browse to 192.168.4.1. From here you can select the local wifi network and enter its password. This needs only to be done once or if changing wifi networks or passwords.
Once the device has connected to its local network it will listen for commands. Assuming its IP address is 192.168.0.100 then first use 192.168.0.100:AP_PORT/upload to upload the files in the data folder. This will then allow 192.168.0.100/edit to view and upload further files and also allow 192.168.0100:AP_PORT to be used to send test commands.
Step 5: Usage
Everything is controlled from the one button. The action occurs when the button is released. Different actions occur when the button is held down for short, medium or long periods before being released.
To turn on the unit press the button once. The caliper display should come on at once. The wifi may take a few seconds to connect to the local network.
Browse to http://ipCalipers/ where ipCalipers is the IP address of the unit. You should see the caliper screen which contains 3 tab views. Measures holds up to 16 measurements. The next one to be taken is highlighted in green. Status shows a table with the current status of the unit. Config shows the current configuration data.
On measures tab, a new measurement is taken by pressing the button for about a second. The new value will be entered into the table and it will step on to the next location. A medium press of about 3 seconds will step the location back one if you need to retake the measurement.
At the bottom of the measures tab is a filename field and two buttons. If the filename is cleared then it will allow a choice from available message files. A new name may also be entered or edited. Note that all message files must start with the prefix (This can be changed in the config). If this is not entered it will be added automatically.
The save button saves the current set of measurements to this file. The load button will try to retrieve a previous set of measurements.
A long press of the button of about 5 seconds will turn the unit off.
Step 6: Web Interface
The firmware supports a set of http calls to support the client interface. These may be used to provide alternate clients if a new index.html is created.
- /edit - access filing system of device; may be used to download measures Files
- /status - return a string containing status details
- /loadconfig -return a string containing config details
- /saveconfig - send and save a string to update config
- /loadmeasures - return a string containing measures from a files
- /savemeasures - send and save a string containing current measure details
- /setmeasureindex - change the index to be used for next measure
- /getmeasurefiles - get a string with list of available measure files