Ruben Laguna's blog

Nov 3, 2008 - 1 minute read - accelerometer arduino electronics mma7260q sensor tilt

Arduino tilt sensor using MMA7260Q accelerometer

I’ve playing with the MMA7260Q accelerometer. Following the indications in

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.

Oct 20, 2008 - 1 minute read - dropbox failure syncing troubleshooting Uncategorized

dropbox not syncing files

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.

Oct 15, 2008 - 4 minute read - arduino atmega168 electronics serial sleep usart

Arduino sleep mode - Waking up when receiving data on the USART

I’ve been playing with the Arduino sleep modes and i wanted to be able to wake up from the sleep when receiving data on the serial port. Mainly, because in my project I’m using the XBee in the API mode and the tricks exposed in http://www.arduino.cc/playground/Learning/ArduinoSleepCode and http://www.libelium.com/squidbee/index.php?title=Save_power_in_SquidBee_-_sleep_mode involve putting Arduino in SLEEP_MODE_PWR_DOWN and using an extra pin on the arduino to monitor the RX pin and detecting LOW.

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.

Sep 6, 2008 - 2 minute read - arduino electronics firmware shield upgrade xbee zb zigbee

Upgrading Xbee Series 2 (XbeeShield) to Xbee ZB with Arduino

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.

The procedure if fairly straighforward

  1. Remove ATmega168 from Arduino board
  2. Insert XbeeShield into Arduino
  3. Change *both *jumpers in XbeeShield to USB
  4. Connect Arduino to the computer using the USB cabke
  5. Download the ZNet 2.5 to ZB Conversion Kit here
  6. Start the X-CTU 5.1.4.1 software
  7. xbee01
  8. Select the proper COM port (should be Usb serial port (COMX))
  9. 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
  10. xbee02
  11. Go to the Modem Configuration tab
  12. Download the ZNet 2.5 to ZB Conversion Kit here if you didn't do it earlier
  13. Uncompress the ZIP
  14. xbee11
  15. Select the “Download new versions” button.
  16. xbee12
  17. Press the “File” source button
  18. Select the xbee_zb.zip file to add the firmware set to X-CTU
  19. 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 COORDINATOR API. Check the product manual to find out about API and AT modes and the different firmwares for each set
  20. xbee03
  21. Press "Write" and X-CTU will start uploading the firmware to the module
  22. xbee04 xbee05
  23. 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+

NOTE 2: Be aware that putting XBee to sleep will also raise DIO7 and produce and Arduino reset. See this other post on XBee sleep and Arduino reset

Aug 31, 2008 - 3 minute read - arduino digital ds1620 electronics measure measurement sensor temp temperature

Arduino and DS1620 digital temperature sensor

I received a couple of Arduinos Diecimilla that I bought from Libelium.

My first project with Arduino has been interfacing with DS1620 digital temperature sensor.

Picture 17

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.

Aug 7, 2008 - 1 minute read - java jnlp netbeans webstart

Java WebStart UnavailableServiceException

If you are getting javax.jnlp.UnavailableServiceException from javax.jnlp.ServiceManager.lookup() or if javax.jnlp.ServiceManager.getServicesNames returns null you must be aware that those call only return useful thing when you run your code from the Java Web Start environment.

It’s not enough to include the jnlp.jar or javaws.jar in the classpath.

For example to make it work from Netbeans you must enable WebStart in the project and Set Configuration to WebStart.