June 13, 2013

Random numbers with Arduino

I was looking for a good random numbers function for Arduino. Here is a summary of what i found so far.

Pseudo-random algorithm

An algorithm that produce a sequence of numbers. It will generate the same sequence every time it is used. The built in Arduino library uses this method.

Sampling an unconnected analog input

The TrueRandom library used this approach. Seems to producing more 0s than 1s.

Independent Counter

The probably_random libray uses two counters with independent sources. Seems promising.

TRNG (True Random Number Generator) module

The Atmel SAM3X8E on Arduino DUE has a dedicated block for random numbers. There is a library available for this: advancedFunctions.

May 17, 2013

Electronics Home Lab

I have built my home lab inside a computer cabinet (IKEA Husar). It has a pull-out keyboard shelf that I use it as an extension of the workspace when the doors are open. My inspiration came from a friend that had built his lab in a two door closet. The main idea is to have a workspace that can be closed when not used and to be able to resume my work later. I have used this lab for nearly ten years and I am still happy with it!

In the upper part of the cabinet I keep commonly used tools and instruments. On the top shelf are two PSUs, a signal generator, assortment boxes with components, the SMD component kit and shelf trays with cables and small tools. On the lower shelves are things like multimeter, callipers and a power drill. At the bottom is the work space with a soldering station. On the left wall are screwdrivers, wrenches and pliers. To the left are cables hanging on hooks.The thing hanging under the shelf is an old radio scanner. You can also see a small vise hanging on the front of the workspace.

The lower part of the cabinet is used for storage of less commoly used things and toolboxes. To easily find what I looking for I use stackable clear plastic boxes.

When the doors are closed it blends nicely in to the rest of the apartment so that the muggles don't find it ;-)

May 7, 2013

Follow me on Twitter

I will start post my blog updates and other interesting things on twitter. My user name is @pthalin.  Follow me by clicking the Follow button to the right on top of this page.

April 26, 2013

Stop motion with Pentax K5 and Arduino


Sebastian Setz has created an Arduino library that can emulate an IR remote for a system camera. It supports all major brands. I created a sketch that takes a picture when i push a button. I used it to create a stop motion movie where it is important not to move the camera between shots. This library could also be used to make time laps shots where the camera takes pictures at a defined interval.

Below you can see my set up for the stop motion. To make a video of the jpg images i used MakeAVI.


Here is the video.
 

April 16, 2013

Develop for Arduino on Android - ArduinoDroid

ArduinoDroid is an Arduino development environment (IDE) for Android providing (almost) the same functionality as the computer version. Almost since not all boards and functions are supported yet. An OTG cable and Android device capable of OTG are needed to upload code to the board.

I loaded the app on my Sony Xperia V and compiled the blinker example.Then I connected the Arduino UNO and upload it without problems! A great job done by Anton Smirnov that develops this.

My set up.
 

Screenshot

April 12, 2013

Fixing slow and not responding Firefox

After the latest updates of Firefox it has started run extremely slow both at startup and when surfing. I often got "not responding" and freeze of Firefox for several seconds when loading a web page. I have also seen this on other computers. Finally I have found the magic cure. What you need to do is a reset that will rebuild your profile while keeping the most important settings (bookmarks, passwords, etc) and removing old junk.

To do the reset open the "Troubleshooting Information" window:
Windows XP: Help -> Troubleshooting Information
For later versions of Windows: Firefox > Help -> Troubleshooting Information 

Then press the Reset Firefox button.

For a detailed description see the Mozilla support here.

April 9, 2013

Arduino Pro Mini low power modification


In this post I use an Arduino Pro Mini 5V 16 MHz MEGA328 powered by an external 5 V source. My application will run on a small battery so I need to minimize the power consumption. I measured the board to consume about 16 mA in normal operation.

My application can be in sleep mode until an event occurs. This is how to enter sleep mode:
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();


Make sure to used this include:
#include <avr/sleep.h>

Wake-up from sleep mode is done with an interrupt. That part is not covered in this post. In sleep mode I measured the current consumption to be 476 uA (microampere). To improve this is I did the following:
  1. Disabled the power on LED by removing the current limiting resistor. It got down to 152 uA.
  2. Removed the unused on board 5 Volt regulator to avoid leakage. This resulted in 136 uA.
The picture below shows the positions of the components that I have removed.

The battery that I will use is a 3.7 V 230 mAh Li-Po regulated by a TI TPS61200 Boost Converter. With an assumed efficiency of 90% I get 230 * (3.7 / 5) * 0.9 = 153 mAh. This gives the theoretical time of operation:

Sleep mode before: 476 uA => 321 h (~13days)
Sleep mode after: 136 uA => 1125 h (~46 days)
Normal operation  mode: 16 mA =>9.5 h

Conclusion: The improvement of the modification is about 3.5 times longer standby time in sleep mode. I was hoping for a month of standby time so with the improvements it should be enough for my design.