I connected X,Y and Z of the MMA7260Q breakout to A0, A1 and A2 of the Arduino. Then, GS1 and GS2 connected to ground to set the range to 1.5g. Ah, and of course, I connected ^SLEEP to VCC.
I managed to put together this piece of code that ouputs the tilt angles ρ(rho) , φ(phi); and Θ(theta) in degrees. I does automatic autozero calibration so before getting sensible results you should tilt the sensor around +/-90 degrees in every axis.
Today I fixed my dropbox installation on mac os x . It was not updating (sending) files from the Mac to the Dropbox servers. In fact it was sending new files to dropbox servers but some old files that were supposed to be on dropbox account were not synchonized and I couldn’t get Dropbox to notice that, until today. I found this post and it seems that if you close dropbox, delete the ~/.dropbox directory and restart dropbox you’ll get the account linking screen again and dropbox will index everything and make sure that your local Dropbox directory match the online one. It took a while but all the files are safely transferred to Dropbox now.
I didn’t like that much that solution so I started to look into other ways of doing it without using an extra pin and without risk of losing data in the serial interface. Because as I understood it using SLEEP_MODE_PWR_DOWN requires to send first a burst of data to the serial interface in order to wake up the arduino. And it takes a while for the Arduino to become fully functional so that means that you will lose/miss data in the serial interface. That was something that didn’t fit my project.
In order to be able to sleep but without missing serial data I used POWER_MODE_IDLE, a power saving mode that leaves the USART on and then using the functions defined in power.h (you have to use arduino-12 to get power.h) I disabled all other modules that I don’t need to cut down the power consumption. When any data is received in the USART the Arduino will be brought back to normal power mode (USART uses interrupts and any interrupt makes the ATmega168 to exit the power saving mode).
<span class='line'>/* Sleep Demo Serial
</span><span class='line'> * -----------------
</span><span class='line'> * Example code to demonstrate the sleep functions in a Arduino. Arduino will wake up
</span><span class='line'> * when new data is received in the serial port USART
</span><span class='line'> * Based on Sleep Demo Serial from http://www.arduino.cc/playground/Learning/ArduinoSleepCode
</span><span class='line'> *
</span><span class='line'> * Copyright (C) 2006 MacSimski 2006-12-30
</span><span class='line'> * Copyright (C) 2007 D. Cuartielles 2007-07-08 - Mexico DF
</span><span class='line'> *
</span><span class='line'> * With modifications from Ruben Laguna 2008-10-15
</span><span class='line'> *
</span><span class='line'> * This program is free software: you can redistribute it and/or modify
</span><span class='line'> * it under the terms of the GNU General Public License as published by
</span><span class='line'> * the Free Software Foundation, either version 3 of the License, or
</span><span class='line'> * (at your option) any later version.
</span><span class='line'> *
</span><span class='line'> * This program is distributed in the hope that it will be useful,
</span><span class='line'> * but WITHOUT ANY WARRANTY; without even the implied warranty of
</span><span class='line'> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
</span><span class='line'> * GNU General Public License for more details.
</span><span class='line'> *
</span><span class='line'> * You should have received a copy of the GNU General Public License
</span><span class='line'> * along with this program. If not, see <http://www.gnu.org/licenses/>.
</span><span class='line'> *
</span><span class='line'> */
</span><span class='line'>
</span><span class='line'>#include <avr/power.h>
</span><span class='line'>#include <avr/sleep.h>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>int sleepStatus = 0; // variable to store a request for sleep
</span><span class='line'>int count = 0; // counter
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>void setup()
</span><span class='line'>{
</span><span class='line'>
</span><span class='line'> Serial.begin(9600);
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>void sleepNow()
</span><span class='line'>{
</span><span class='line'> /* Now is the time to set the sleep mode. In the Atmega8 datasheet
</span><span class='line'> * http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf on page 35
</span><span class='line'> * there is a list of sleep modes which explains which clocks and
</span><span class='line'> * wake up sources are available in which sleep modus.
</span><span class='line'> *
</span><span class='line'> * In the avr/sleep.h file, the call names of these sleep modus are to be found:
</span><span class='line'> *
</span><span class='line'> * The 5 different modes are:
</span><span class='line'> * SLEEP_MODE_IDLE -the least power savings
</span><span class='line'> * SLEEP_MODE_ADC
</span><span class='line'> * SLEEP_MODE_PWR_SAVE
</span><span class='line'> * SLEEP_MODE_STANDBY
</span><span class='line'> * SLEEP_MODE_PWR_DOWN -the most power savings
</span><span class='line'> *
</span><span class='line'> * the power reduction management <avr/power.h> is described in
</span><span class='line'> * http://www.nongnu.org/avr-libc/user-manual/group__avr__power.html
</span><span class='line'> */
</span><span class='line'>
</span><span class='line'> set_sleep_mode(SLEEP_MODE_IDLE); // sleep mode is set here
</span><span class='line'>
</span><span class='line'> sleep_enable(); // enables the sleep bit in the mcucr register
</span><span class='line'> // so sleep is possible. just a safety pin
</span><span class='line'>
</span><span class='line'> power_adc_disable();
</span><span class='line'> power_spi_disable();
</span><span class='line'> power_timer0_disable();
</span><span class='line'> power_timer1_disable();
</span><span class='line'> power_timer2_disable();
</span><span class='line'> power_twi_disable();
</span><span class='line'>
</span><span class='line'>
</span><span class='line'> sleep_mode(); // here the device is actually put to sleep!!
</span><span class='line'>
</span><span class='line'> // THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP
</span><span class='line'> sleep_disable(); // first thing after waking from sleep:
</span><span class='line'> // disable sleep...
</span><span class='line'>
</span><span class='line'> power_all_enable();
</span><span class='line'>
</span><span class='line'>}
</span><span class='line'>
</span><span class='line'>
</span><span class='line'>void loop()
</span><span class='line'>{
</span><span class='line'> // display information about the counter
</span><span class='line'> Serial.print("Awake for ");
</span><span class='line'> Serial.print(count);
</span><span class='line'> Serial.println("sec");
</span><span class='line'> count++;
</span><span class='line'> delay(1000); // waits for a second
</span><span class='line'>
</span><span class='line'> // compute the serial input
</span><span class='line'> if (Serial.available()) {
</span><span class='line'> int val = Serial.read();
</span><span class='line'> if (val == 'S') {
</span><span class='line'> Serial.println("Serial: Entering Sleep mode");
</span><span class='line'> delay(100); // this delay is needed, the sleep
</span><span class='line'> //function will provoke a Serial error otherwise!!
</span><span class='line'> count = 0;
</span><span class='line'> sleepNow(); // sleep function called here
</span><span class='line'> }
</span><span class='line'> if (val == 'A') {
</span><span class='line'> Serial.println("Hola Caracola"); // classic dummy message
</span><span class='line'> }
</span><span class='line'> }
</span><span class='line'>
</span><span class='line'> // check if it should go asleep because of time
</span><span class='line'> if (count >= 10) {
</span><span class='line'> Serial.println("Timer: Entering Sleep mode");
</span><span class='line'> delay(100); // this delay is needed, the sleep
</span><span class='line'> //function will provoke a Serial error otherwise!!
</span><span class='line'> count = 0;
</span><span class='line'> sleepNow(); // sleep function called here
</span><span class='line'> }
</span><span class='line'>}</span>
As stated in this digi page is possible to upgrade/convert a Xbee Series 2.5 to a Xbee ZB (with full standard Zigbee capabilities). Xbee Series 2.5 is just another name for the forme Series 2, so the upgrade procedure is exactly the same.
Select the proper COM port (should be Usb serial port (COMX))
Click on Test Query. The following dialog should appear indicating that X-CTU found the Xbee in that COM port and giving you some information about the Xbee module version, etc. In my case it was a ZB24-B with 1220 firmware
Select the xbee_zb.zip file to add the firmware set to X-CTU
Back to the Modem Configuration tab. Select “Always update firmware” checkbox and select XB24-ZB (or XB24P-ZB if you have a PRO module) and the function set that you want for the module (router, coordinator, end device, each one in two differente flavor AT or API). In my case I selected XB24-ZB and COORDINATORAPI. Check the product manual to find out about API and AT modes and the different firmwares for each set
Press “Write” and X-CTU will start uploading the firmware to the module
The firmware upgrade is complete
NOTE: Make sure that the configuration for DIO7 is DISABLED as this XBee pin is connected to the RST in the Arduino. If you leave the default option (1 – CTS) random resets after a couple of seconds may occur+
I notice this problem when editing Visio objects embedded into Microsoft Word documents. In my case after I enabled Bluetooth (via my Compaq nw8440 special keyboard button) this problem went away.
It was really easy it just a matter of connecting pin 3, 4 and 5 on the Arduino to RST, CLK and DQ on the DS1620. The source code in this post will read the temperature from the DS1620 using the 3 wire interface and it will output the result to the serial interface in the Arduino.
The DS1620 measures temperatures from -55°C to +125°C
in 0.5°C increments. As you can see in the code reading a DS1620 sensor is way more complicated than reading an analog LM35 temperature sensor (and the LM35 gives you more precision and also takes one pin instead of three) so probably is a LM35 is a better option if you want an easy way to get the temperature in your arduino project.