Wednesday, October 1, 2014

What's your favorite type of sensor?

Arduino's are great devices because they let us sense our environment around us. There are a great number of sensors available that can work with the arduino. Digital sensors allow us to sense whether something is on, or off, like a door switch. Analog sensors allow us to sense how much of something exists, like how much light, or pressure. Some sensors give us actual data streams, like a gps sensor, instead of simple on/off, or a varying voltage.

What are your favorite types of sensors?
What do you like to sense?
Give us feedback if we missed yours, or post links to the project you have personally made!


What is your favorite sensor?











pollcode.com free polls

Poll doesn't work? See
What is your favorite sensor?

Saturday, September 27, 2014

Arduino Seismic / Vibration Sensor

Want to sense Earthquakes? Maybe equipment vibration? We have put together a quick and inexpensive project that will sense vibration. We use a Vibration sensor from Sparkfun, a SainSmart UNO, and a I2C LCD.

We have created a bar graph that moves back and forth based on vibration intensity, and a "Earthquake" message that displays when the level exceeds a threshold.

I2C library and LCD tutorial

See Code and Video below:


Code:

//sensitivity variables
int minimum = 200;
int maximum= 1023;
int maxdelay = 400;

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // change to your address found with I2C scanner
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

// Custom Character
byte seismic[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
};

//defines the pin connections
int sensePin= 2;


void setup()
{
Serial.begin(9600);

lcd.begin (16,2); // or (20,4)
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);

lcd.createChar(0, seismic);
lcd.begin(16, 2);

}

void loop()
{
int reading= analogRead(sensePin);
Serial.println(reading);
reading = constrain(reading, minimum, maximum);
Serial.println(reading);
reading = map(reading, minimum, maximum, 0, 15);
Serial.println(reading);
lcd.clear();

for (int i=0; i <= reading; i++){
lcd.write(byte(0));

}

if (8<=reading){
lcd.setCursor(0, 1);
lcd.print("Earthquake");
delay(500);
}

delay(maxdelay);
lcd.clear();

}






Saturday, September 20, 2014

Arduino Himalayan Salt Candle

Himalayan Salt Lights are really cool looking translucent salt "Rocks". With a lightbulb inside, not only are they a soothing warm light, but they are supposed to give off Negative Ions that leave you refreshed. I have added a Arduino and  SSR to give my light a flickering candle look, which makes it a very interesting conversation piece.

Video, code, and parts list below!


Parts:

Arduino UNO
Solid State Relay (SSR)
Himalayan Salt Light

Code:


int lightPin = 9;   
int randNumber;

void setup()  { 
  randomSeed(analogRead(0));
  pinMode(lightPin, OUTPUT);  

void loop()  { 
    randNumber = random(50, 254);
    analogWrite(lightPin, randNumber);   
    delay(randNumber*3);     
  } 


Tuesday, September 16, 2014

De-Soldering Can Be A Pain!

I typically hate de-soldering. Removing old parts, or re-working a new design can be tricky, as you can over heat a part, damage the board, etc. Well, I've been using a inexpensive manual vacuum tool for months now, and it works GREAT! Cleans the holes out well, and the parts drop right out. The Soldapullt DS-017 is the perfect companion to my Sparkfun variable temperature soldering station.


Tuesday, September 2, 2014

The Under $5 Arduino

Next time you build a permanent project, don't waste a $15-$30 Arduino board. You can get the same functionality of the Arduino UNO for less than $5 at http://goo.gl/ZhOrrh

No usb or power onboard (requires 5v). Program it with an existing UNO or a FTDI Cable.

Will post a programming tutorial as soon as these arrive!

Friday, August 22, 2014

Pan & Tilt, Arduino Style

I've been wanting to play with an Arduino controlled Pan & Tilt Mechanism for quite some time. Today I ordered a kit that will be a prototype for a solar array on a bigger scale. I'll be using this Pan & Tilt Mechanism. The kit includes brackets, two miniature servos and all the nuts and bolts. I'll mount a small solar panel from a garden light on here, and keep you posted as to my progress.

Update: Received kit 8/25/14
Check your hardware package before starting assembly! Mine was missing a small self tapping screw for holding the servo to the wheel. Jameco sending replacement hardware.
Update: Received replacement hardware 8/29/14. Jameco Rocks!

Thursday, August 21, 2014

Albert Piganti Updates Arduino Basic Connections

Albert Piganti, known as Pighixxx, is well known for his beautiful artwork depicting various microcontrollers like the Arduino and Raspberry Pi, and the various accessories and connections that can be made with them. He is updating his original designs, and you can find them at http://forum.arduino.cc/index.php?topic=154549.msg1850477#msg1850477
and
http://forum.arduino.cc/index.php?topic=154549.msg1850479#msg1850479

Friday, August 15, 2014

4 Channel 16 Bit ADC Arduino / Raspberry Pi

The Arduino UNO has five 10 bit Analog to Digital Converter pins (0-1023), but I needed higher resolution. I'm working with a I2C connected 16 bit 4 channel ADC from Adafruit called the ADS1115. 16 bits of resolution allows me to measure signed integers with values ranging from negative 32768 through positive 32767 (-5v to +5v). Although I'm running this single ended (measuring 4 separate inputs in respect to ground), it can also run in a 2 channel differential mode. This would measure the voltage difference between AIN0 and AIN1, and between AIN2 and AIN3. I'm multiplying the value being reported by the ADC by .000188 (188uV / bit) to get the voltage being supplied to the input.



The Raspberry Pi has no ADC, and can only read digital inputs, so this would be a nice addition, as the Pi does have a I2C interface. I'll post an article on the code for doing this soon. Here is the code for the Arduino. Complete tutorial, connections, and library available at https://learn.adafruit.com/adafruit-4-channel-adc-breakouts


#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1115 ads1115;

void setup(void)
{
  Serial.begin(9600);
  Serial.println("Hello!");

  Serial.println("Getting single-ended readings from AIN0..3");
  Serial.println("ADC Range: +/- 6.144V (1 bit =  188uV)");
  ads1115.begin();
  //ads1115.setGain(GAIN_TWOTHIRDS);
}

void loop(void)
{
  int16_t adc0, adc1, adc2, adc3;
  float volt0, volt1, volt2, volt3;

  adc0 = ads1115.readADC_SingleEnded(0);
  adc1 = ads1115.readADC_SingleEnded(1);
  adc2 = ads1115.readADC_SingleEnded(2);
  adc3 = ads1115.readADC_SingleEnded(3);
  volt0 = adc0*0.000188;
  volt1 = adc1*0.000188;
  volt2 = adc2*0.000188;
  volt3 = adc3*0.000188;
  Serial.print("AIN0: ");
  Serial.print(adc0);
  Serial.print(" ");
  Serial.print(volt0, 4);
  Serial.println(" vdc");
  Serial.print("AIN1: ");
  Serial.print(adc1);
  Serial.print(" ");
  Serial.print(volt1, 4);
  Serial.println(" vdc");
  Serial.print("AIN2: ");
  Serial.print(adc2);
  Serial.print(" ");
  Serial.print(volt2, 4);
  Serial.println(" vdc");
  Serial.print("AIN3: ");
  Serial.print(adc3);
  Serial.print(" ");
  Serial.print(volt3, 4);
  Serial.println(" vdc");
  Serial.println(" ");

  delay(1000);
}

Wednesday, August 6, 2014

Dual RFID Readers

I have an application that needs two RFID readers. Because these RFID readers are SPI devices, they can be connected to the same two data pins (MISO & MOSI), and clock pin (SCK), and only two pins (SDA & RST)  have to be unique. This makes a total of 7 data pins, plus 3.3v and Gnd. I'm taking the 5 sets of serial numbers, and adding them together, and making each reader accept a different set of numbers. Run the serial monitor, scan your badge or keyfob, and then enter the total code into your sketch to make it active. You could have two security doors, and one badge will get you through one, but a different badge can get you through both. Get the code and library here!



Friday, July 25, 2014

Constant Current, or Constant Voltage?

I needed a Constant Current power supply for my bench. Now I don't know if you have priced bench power supplies lately, but they can be several hundred dollars. Not any more! Would you believe a 40v 3a adjustable voltage or current supply for about $20?
http://goo.gl/WYD7m3
I grabbed a used 24vac HVAC transformer, soldered a bridge rectifier on top, and fed the input on this board. I put a 300ma 1w LED on the output, and I'm controlling the brightness by controlling the current, even down to 2ma (dim), all the way up to 300ma (blindingly bright). I could go higher, up to 3000ma, but that will let the magic smoke out.


Wednesday, July 23, 2014

Put the Physical into Physical Computing!

The whole point of microcontrollers and physical computing is doing something with the data sensed. If you sense a temperature, if you sense motion, you act on it. However, There's a bunch of science involved when you want to make things move, making sure you have enough power to move said object. The best explanation of the science of making things move is "Making Things Move DIY Mechanisms for Inventors, Hobbyists, and Artists" by Dustyn Roberts.
I've written about this book before, and I own it in paperback and kindle version, because it's that important to Arduino and Raspberry Pi owners. If you want action, you need this book. It simplifies the "magic" of making your microcontroller make things move, in some cases, very large objects.

Sunday, July 6, 2014

Creating the Super Simple Library

Functions allow you to remove repetitive routines from your main code, and call them when needed. There are times when you would like to move commonly used functions out of your Arduino sketch entirely, and into a library you can call from your sketch. This helps clean up your sketch visually, and allows you to reuse code without having to recreate it each time. Below is a simple sketch that takes a value in Celsius, and converts it to Fahrenheit. I'll show you how to convert that into a called function, then I'll repost it by calling an external library that does the same thing. This is kept simple, in order to show the process. There is much more you can do with libraries, but this is the bare minimum to get it to work.

Original sketch without a function:

float celsius = 20;
float tempF = 0;

void setup()
{
  Serial.begin(9600);
  tempF = (1.8 * celsius) + 32;
  Serial.print(tempF);
}

void loop()
{
  
}



Original sketch with a function:

float celsius = 20;
float tempF = 0;

void setup()
{
  Serial.begin(9600);
  tempF = tempConvert(celsius);
  Serial.print(tempF);
}

void loop()
{
  
}


float tempConvert(float celsius)
{
  float fahrenheit = 0;
  fahrenheit = (1.8 * celsius) + 32;
  return fahrenheit; 

}

Now let's remove the function tempConvert, and put it in a seperately called library, ( a pair of .h & .cpp files).

Sketch calling libary:

float celsius = 20;
float tempF = 0;

#include <tempConvert.h>

void setup()
{
  Serial.begin(9600);
  tempF = tempConvert(celsius);
  Serial.print(tempF);
}

void loop()
{
  
}

put the following two files in a folder called tempConvert, inside the libraries folder.

tempConvert.cpp

// tempConvert.cpp

#include "Arduino.h"   
// use: Wprogram.h for Arduino versions prior to 1.0

#include "tempConvert.h"

float tempConvert(float celsius)
{
  float fahrenheit = 0;
  fahrenheit = (1.8 * celsius) + 32;
  return fahrenheit; 
}

tempConvert.h

/*
 * tempConvert.h
 * Library header file for tempConvert library
 */
#include "Arduino.h"

float tempConvert(float celsius);  // function prototype

For more on creating libraries, see http://arduino.cc/en/Hacking/LibraryTutorial


Sunday, June 29, 2014

Arduino, or a Raspberry Pi, What's better?

Well that question is like asking what's better, a hammer, or a saw? It all depends on what you are trying to accomplish. If you are trying to read analog and digital inputs, make a decision, and control a device, the Arduino is the clear winner. If you need to run a linux operating system, with web and database services, full screen displays, and keyboard and mouse input, then the Raspberry Pi is more appropriate. There are many projects that are best served with a combination of the two. For instance, we use a network of Arduino's as sensors, feeding a database running on a Pi, and other Arduino's are picking up jobs from the database to be executed. This could not be done by an Arduino or a Raspberry Pi alone. So don't limit yourself to making choices, take both home, thay are small!

SainSmart Arduino Uno - $17
Raspberry Pi - $37 (needs a SD Card)




Wednesday, June 25, 2014

Setting up Arduino to work via Windows Embedded and RDP

by Mike Maynard

So here is my situation.  I had the brilliant idea to set up virtual machines for my boys to use, and let them access them via an HP Thin Client, and Windows Remote Desktop.  Great idea right?  I thought so..... right up to the point where I wanted to introduce them to the Arduino.....

The Thin clients are running Windows Embedded Standard (WES) an embedded version of XP.  They then connect to their Win 8.1 pro virtual machines using remote desktop.  Its actually set up so when they log into the the thin client (TC) the remote desktop session (RDP) auto launches and connects them to their virtual machine.

The directions that follow make the following assumptions:

  • You already know how to setup and use an Arduino on a standard computer
  • You are somewhat familiar with driver installations
  • You understand the basics of making a Remote Desktop Connection and how to set its options prior to the connection.


The first problem is, WES does not have driver support for the Arduino.  After much digging I stumbled upon this article - http://www.maxvalente.com/2013/03/installing-arduino-on-windows-embedded/ - which was instrumental in making this work.

I only needed 2 files from his list

  • usbser.sys
  • mdmcpq.inf
I originally tried copies out of a Windows 7 install, but I am not sure they will work.  Not having a handy XP install, I turned to google.  I found the needed files, and downloaded them along with the standard Arduino fileset from www.arduino.cc  (download the zip and not the exe, since we only need the drivers at this point).  Extract the Arduino zip someplace handy, and add the 2 above files to the drivers directory.

Plug in your arduino and let the driver install process start.  Choose the driver folder location inside the arduino directory, and voila - you should have a functional Arduino COM port!  (note: on both of my installs, I had placed a copy of usbser.sys into c:\windows\system32\drivers\ first.  I am not sure if this is necessary or not.  Also on one TC, it asked me to locate that file on my windows xp install disk, I just pointed it to the one in the above mentioned drivers directory and it worked fine)


Now on to the second problem!

Now that we have a working COM port for the Arduino on the TC - we need to pass it through to the RDP session.  I have several hours of banging my head against the wall here, and its really a simple solution, courtesy of this post here:  http://www.thinstuff.com/faq/index.php?action=artikel&id=27

Long and short, upon making your RDP connection, click the options dropdown.  then choose the Local Resources tab, followed by the 'more' button.  Then check the Ports checkbox, and click OK.  Then you can make your connection like normal (or save the connection for simple use later)

Once you connect to your remote session, your Arduino Com port should be passed through to the remote session, using the same Com port  #.

Voila!! - you now have an arduino plugged into a Windows Thin Client, and passed through to the Remote Desktop Session of another machine.


Friday, June 20, 2014

Arduino Bar Code Reader

Use Bar Coded ID Badges in your time card or security application? Want to teach your Arduino to read Bar Codes? Get a PS/2 style card reader, and connect it to The Arduino PS/2 Keyboard Smart Interface, and you have Bar Code Badge ID's flowing into your Arduino security application!