Thursday, November 1, 2012
Pressure sensor for CTD
Using mpx4250ap-nd from Digikey
Sunday, October 28, 2012
Saturday, October 27, 2012
Using Interrupts With the Arduino
Good explanation of Interrupts with the Arduino from Dave Auld
The
The
param1 = Which interrupt to listen for. This is the Interrupt Number not the Digital In number
param2 = Which code function to call, this must be a method that takes no parameters and returns no value.
param3 = Which condition to watch for.
The Arduino can listen for 4 types of condition changes. These are;
LOW = The input is at a LOW state
RISING = The input state changes from LOW to HIGH
FALLING = the input state changes from HIGH to LOW
CHANGE = The input state changed from HIGH to LOW or LOW to HIGH, i.e. has changed its state
ReAssigning Interrupts
Interrupts can be changed at any point by using the
Starting / Stopping Interrupts
The Arduino also has the ability to temporarily ignore all the interrupts. You may want to do this if you have some sensitive code that must be executed without interruption. In this case you would issue a
Removing Interrupts
Interrupts can also be removed by using the
The
volatile keyword is added to the state
variable, this causes the compiler to use RAM instead of a storage
register. This is done because the storage register can be temporarily
inaccurate if they are being modified by areas other than the main
thread. In the Arduino, this relates to code being triggered by
interrupts.The
attachInterrupt(param1, param2, param3) requires 3 parameters, these are;param1 = Which interrupt to listen for. This is the Interrupt Number not the Digital In number
param2 = Which code function to call, this must be a method that takes no parameters and returns no value.
param3 = Which condition to watch for.
The Arduino can listen for 4 types of condition changes. These are;
LOW = The input is at a LOW state
RISING = The input state changes from LOW to HIGH
FALLING = the input state changes from HIGH to LOW
CHANGE = The input state changed from HIGH to LOW or LOW to HIGH, i.e. has changed its state
ReAssigning Interrupts
Interrupts can be changed at any point by using the
attachInterrupt() method. As soon as this is done, any previously assigned interrupt on the associated pin is removed.Starting / Stopping Interrupts
The Arduino also has the ability to temporarily ignore all the interrupts. You may want to do this if you have some sensitive code that must be executed without interruption. In this case you would issue a
noInterrupts() call. Once your sensitive code block has completed, interrupts can be restarted by calling interrupts().Removing Interrupts
Interrupts can also be removed by using the
detachInterrupt(interrupt_number) method.
Tuesday, October 23, 2012
Interrupts on an Arduino
Save power on arduino
Narcoleptic library by Peter Knight
Caveats:
Library implementing sleep modes, allowing extremely low power consumption on Arduino based projects.
Narcoleptic uses the sleep functionality of the AVR microcontroller to almost completely shut down the entire CPU, just leaving a low power timer running to trigger the wake up.
Extract the download, and install in your Arduino Libraries directory. Restart Arduino and you will see the Narcoleptic library appear in the menus.
Syntax:
Narcoleptic.delay( time in milliseconds )
Note that Narcoleptic timings are only accurate to a few percent. Whilst sleeping, everything is stopped - including PWM outputs, the millis() timer, serial ports - everything. So code with this in mind.
Caveats:
Library implementing sleep modes, allowing extremely low power consumption on Arduino based projects.
Narcoleptic uses the sleep functionality of the AVR microcontroller to almost completely shut down the entire CPU, just leaving a low power timer running to trigger the wake up.
Extract the download, and install in your Arduino Libraries directory. Restart Arduino and you will see the Narcoleptic library appear in the menus.
Syntax:
Narcoleptic.delay( time in milliseconds )
Note that Narcoleptic timings are only accurate to a few percent. Whilst sleeping, everything is stopped - including PWM outputs, the millis() timer, serial ports - everything. So code with this in mind.
Sunday, October 21, 2012
Conductivity and arduino
Building a small submersible conductivity probe using the details from EMEsystems. I used to use a BASIC stamp for some of these measurements so time to pass this info to the Arduino.
Subscribe to:
Posts (Atom)