(this article is a work in progress). My own advice will be added later...
Having a system that regularly writes parameters to the EEPROM can wear out the EEPROM, since it is only guaranteed to endure 100 k erase/write cycles. Writing the parameters to a circular buffer in EEPROM where each of the elements in the buffer can endure 100 k erase/write cycles can circumvent this. However, if the system is exposed to RESET conditions, such as power failures, the system needs to be able to identify the correct position in the circular buffer again. This document describes how to make safe high endurance parameter storage in EEPROM/
Read more: http://www.atmel.com/images/doc2526.pdf
There are many Arduino sketches on the Web that provide sample code how to work with MAXIM’s (formerly DALLAS) DS18B20\DS18S20 digital temperature sensors. However, most of them do not describe the process in details. In this article, I’m going to show the gears that make the whole thing work.
In this article I’ll describe how to connect and use it with your Arduino board.
You can download the datasheet from hoperf.com.
Have you ever encountered situations when your Arduino-based device hangs?
There are many reasons for this - from millis() overflow in 49 days to moisture in outdoor sensors (causing them not to respond)...
But what if your device is not easily accessible and\or works for long periods without human supervision? Such situations should be prevented in this case. You don't want your plant watering system that you left to look after your plants and flowers during your vacation to hang on the second day, leaving your loved plants without water, really?
Most MCUs, including those used in Arduino, has a special feature, called Watchdog timer. Once it is configured, it checks for 'heartbeat' signals (or commands) that your MCU should issue. As soon as the time since the last pulse exceeds configured treshold, watchdog initiates reset sequence. This is really convenient, and ensures that your system will be in hanged state for no more than watchdog threshold.
I once encountered sudden hangs of my standalone arduino-based device. I run all possible tests, double-checked all circuitry, replaced MCU - with no effect. Finally I examined wires to external OneWire DS18B20 temperature sensor. The resistance between Vcc and GND was 600 Ohm! Then I looked through the window - it was foggy and raining... The insulation of the sensor was rather old and had a leak. As soon as I disconnected the wires leading from the sensor all problems were gone.
Very often we encounter such situations when we need to save something in EEPROM. Arduino offers functions to save\read only byte values. But what if we need to store another data types, integer for instance? Sure, we need to create a simple function that will store two bytes of integer.
But wouldn't it be more loigical to have these functions integrated to EEPROM library? Thinking like that, I've modified it, and now I'm sharing my results.
When you want to measure frequency in your Arduino project most likely you'll choose FreqCounter Library. However, despite FreqCounter is very precise, it may be unsuitable in some cases - because it affects PWM outputs of Atmega microcontroller, rendering analogWrite() functions inoperable.
In this article I'm going to show how to cope with it. However, an approach described here is not just a copy-and-paste solution, it will require adaptation to your project and you will have to do some things on your own. So this way, unfortunately, is not for beginners.
There are many signals that contain necessary information in frequency. For instance, SparkFun's HH100D humidity sensor outputs measurements via frequency signal (although it has i2C interface, those pins are used for reading calibration values. Actual measurements com via FOUT line).
There are two ways to measure a frequency with Arduino:
As you may have noticed, each time you open or close COM port, your Arduino board resets. This may be good for development, but when you put something into production or just create an application that keeps the port open only while transmitting data, it's very disturbing.
There are two ways to prevent this from happening.
We all are familiar with iButton devices - a small chip used as a key almost everywhere:Those keys use Maxim's (formerly Dallas Semiconductor) 1-Wire protocol. It's a nice thing and it is used in many other devices, like temperature sensors (DS18B20, DS18S20 for instance).
As it comes from the name, 1-Wire devices require only one wire for data transfer. Some devices are also capable of using ithis line as a power source. (However, one will still need another wire - for ground).You can attach a large number of devices to the same line. That's especially well when you are using Arduino - OneWire line takes only one digital pin, and you theoretically can plug all you OneWire sensors, keys etc to this line.