Monthly Archives: April 2015

Analog Sensor Calibration

Using a simple mathematical formula, it is possible to calibrate analog sensor readings. If you are using a COTS analog sensor, and have access to a high quality, or more reliable sensor, taking several readings can provide a coefficient and offset for calibration.

In this example, a voltage sensor is implemented with a voltage divider. A digital multimeter is used to glean more accurate readings, and a coefficient/offset is generated with Octave/MATLAB.

All source code can be found on GitHub.

Continue reading

Arduino Mega 2560 R3, ICSP Programming and Bootloader Reload using AVRDUDE

Using an off-board programming tool, it’s possible to program the Arduino Mega 2560 directly through the ICSP pins.

I have a Sparkfun Pocket AVR Programmer at my desk, but according to their documentation as of 04.12.2015, the ATmega2560 is unsupported. Pololu has an inexpensive USB AVR Programmer that is up to task.

Continue reading

jsTree/jQuery, Dynamic Node Addition

jsTree is a jQuery plugin allowing easy integration of interactive trees. Both products are well supported, pervasive and useful. Creating the static jsTree is trivial, but the syntax for dynamically editing the tree after the ‘ready.jstree’ event can be difficult for the newcomer.

My specific use case was to create the tree based on the result from an external web service call. The call finished long after the tree was loaded, so the JSON result needed parsed, and the tree updated.

JSFiddle showing functionality.

Screenshot in case JSFiddle is down:

screenshot