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. Reviews say the nuts and bolts aren't great, so I'll replace with my stock stainless pieces. 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.

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!


Thursday, June 19, 2014

A Better Arduino IDE?

Everyone pretty much agrees that although the Arduino IDE is simple to use, for professional programming it's just not up to par with mainstream code editors.

I've used Notepad++ for several years as my editing environment of choice, for html, css, php, etc.

Would it be possible to use Notepad++ for Arduino Sketch editing? Well as it is, yes, but there's no syntax highlighting, extension recognition, or easy way to upload sketches to the Arduino (a macro that executes "C:\Program Files\Arduino\arduino.exe" $(FULL_CURRENT_PATH)).

All that and more can be done, with a few tweaks of the environment, and a plugin.

Follow the instructions at

http://sriramiyer.net/blog/2014/02/12/using-notepad-plus-plus-instead-of-the-arduino-ide/

then  download the plugin at http://sourceforge.net/projects/narduinoplugin/ and follow the instructions in the README file.








Tuesday, June 3, 2014

Logic Gates (with pulleys)

Computers are built with Logic Gates. A logic gate looks at a input that is either on or off, and makes a decision, producing a output that is either on or off. Different types of logic gates have different outputs. The following video describes the various types, and the associated "truth tables".

 
Pulley Logic Gates from Alex Gorischek on Vimeo.

Thursday, May 29, 2014

Free Circuit Design and Simulation?

What happens when a bunch of makers and hackers decide that they need multiplatform schematic capture, spice simulation and PCB layout and don't like the idea of having to pay lots of money to buy a huge software suite and then spend weeks learning how to use it? EasyEDA Happens!


Cool Schematic Capture

Draw schematics quickly using the available libraries. Share your work, or import from LTSpice , Altium Designer and Eagle files.

Schematic capture image


Clever Spice Simulation

Verify analog, digital and mixed signal circuits with spice subcircuits and models. Get the results quickly from our cloud based servers!

Spice simulation image


Powerful PCB Layout

Export your PCB files to Gerber files, or order your PCBs from EasyEDA directly. Hardware design never come out so easy!

PCB layout image

Friday, May 23, 2014

Getting Kids Interested in Electronics

When I was a kid, my parents got me the 300-In-1 Electronic Project Lab from Radio Shack. Elenco now makes similar units. Although this really kickstarted my interest in electronics (and a 30+ year career), the springs would get bent out of shape, and if you blew a component, it was not so easy to replace. Now with Snap Circuits, younger children can enjoy the excitement of connecting electronics and seeing and hearing the results, with a much more durable product.

Friday, May 9, 2014

What is 123D Circuits?

With 123D Circuits you can design in a familiar breadboard view and the app will guide you to make professional printed circuit boards with built in layout tools. When you’re done just click to have your boards professionally manufactured and shipped for free worldwide.

What’s also cool is how you can easily, simultaneously work on the same circuit with your friends. And at any point you can compile and emulate your Arduino code inside a live, editable circuit!

http://www.123dapp.com/circuits