Wednesday, August 12, 2015

My Favorite eReader - Kindle Paperwhite

Why am I talking about eReaders on a microcontroller site? Well, 5 years ago I had a house fire, and lost my 3000+ title library. I lived in an RV for a couple of years after, and did not have room for a lot of books. That's when I got my first Kindle. I've been through several generations of Kindles now, and my newest is the 300 PPI Paperwhite ($119)

This one is very different. The first thing you notice is the backlit screen, no more need for cases with built in lights, or external lighting. The next thing I noticed was the improved readability. A new font (bookery) that is much easier on the eyes. The 6" screen means it's easy to hold in one hand, and change pages by swiping my finger forward or back.

So, how does this tie in with Microcontrollers?

The complete collection is searchable, so all my Arduino, Raspberry Pi, Python, PHP, MySQL, etc. content is available at a few finger presses. Makes it easy to find what I need to make any new project.

There are other improvements, but these are the ones that stand out for me.

I did get a nice case for it. The Coredy Kickstand Case Cover ($14) protects my Kindle well, has a built in stand and stylus, and automatically turns on my Kindle when I open it. Highly recommended.

Solar charge your kindle / tablet / cell phone -

Monday, August 10, 2015

Measuring Wind Speed with an Arduino / Anemometer

A while back, we got a set of weather sensors from Sparkfun. It includes a Anemometer (speed), Wind Vane (direction), and a Rain Gauge.

I used a hand held wind speed device to calibrate my Arduino code.

I'm using pinMode(2, INPUT_PULLUP); so no pull up or pull down resistor is needed.

I used a prototype dual 6 pin phone jack from IC Breakout to connect the weather sensors to the Arduino.

For this sketch, I connected the two wires from the anemometer to pins 2 (interrupt 0) and ground.


 // diameter of anemometer
 float diameter = 2.75; //inches from center pin to middle of cup
 float mph;
 // read RPM
 int half_revolutions = 0;
 int rpm = 0;
 unsigned long lastmillis = 0;
 void setup(){
 pinMode(2, INPUT_PULLUP); 
 attachInterrupt(0, rpm_fan, FALLING);
 void loop(){
 if (millis() - lastmillis == 1000){ //Update every one second, this will be equal to reading frequency (Hz).
 detachInterrupt(0);//Disable interrupt when calculating
 rpm = half_revolutions * 30; // Convert frequency to RPM, note: 60 works for one interruption per full rotation. For two interrupts per full rotation use half_revolutions * 30.
 Serial.print("RPM =\t"); //print the word "RPM" and tab.
 Serial.print(rpm); // print the rpm value.
 Serial.print("\t Hz=\t"); //print the word "Hz".
 Serial.print(half_revolutions/2); //print revolutions per second or Hz. And print new line or enter. divide by 2 if 2 interrupts per revolution
 half_revolutions = 0; // Restart the RPM counter
 lastmillis = millis(); // Update lastmillis
 attachInterrupt(0, rpm_fan, FALLING); //enable interrupt
 mph = diameter / 12 * 3.14 * rpm * 60 / 5280;
 mph = mph * 3.5; // calibration factor for anemometer accuracy, adjust as necessary
 Serial.print("\t MPH=\t"); //print the word "MPH".
 // this code will be executed every time the interrupt 0 (pin2) gets low.
 void rpm_fan(){