Tuesday, April 7, 2015

20140508 Magnetic Reed Switch & Water Sensor

Specification
1, The use of imported normally open dry Reed tube
2, Comparator output signal clean wave well, driving ability, than 15mA.
3, Rated voltage and 3.3V-5V
4, Outputs: digital switching output (0 and 1)
5, Abolt-hole, is easy to install
6, Small Board PCB dimensions: 3.2cm x 1.4cm
7, Using wide LM393 voltage comparator

Description:
1. The Reed switch and magnet fit is required, at the time of induction to a certain degree of magnetic, on-State, the module output low level, when there is no magnetic force, a
disconnected state, output high, Reed switch and magnets sensing distance of the 1.5cm beyond insensitive or will not trigger the phenomenon;
2. DO the module output can be directly connected to the microcontroller I/O ports, Reed can be detected by single-chip microcomputer trigger status;
3. Modules DO the output connected to the relay IN-formed power Reed switch, direct control of high voltage.


May 8, 2014
Magnetic Reed Switch & Water Sensor  - These two devices work the same way, they are (for the most part) switches, what I found interesting and was not expecting is that both are active low devices, What that means, is they both pass the 3.3v or 5v until the either a magnetic is put to the reed switch, or the contacts on the water sensor are connected, then they go low.
There are probably a dozen of ways to use these, I ended up hooking them to an analog in and reading the voltages from there output lines, and then I turned on the LED connected to pin 13.

My slightly modified sketch:
/*
 ReadAnalogVoltage
 Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
 Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/

// the setup routine runs once when you press reset:
void setup() {
 // initialize serial communication at 9600 bits per second:
 Serial.begin(9600);
pinMode(13, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
 // read the input on analog pin 0:
 int sensorValue = analogRead(A0);
 // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
 float voltage = sensorValue * (5.0 / 1023.0);
 // print out the value you read:
 Serial.println(voltage);
if (voltage > 1) {digitalWrite(13, LOW);}
if (voltage < 1) {digitalWrite(13, HIGH);}
}

I never saw these ever make it clear to zero volts, but I don’t know what kind of resolution the A2D converter has, and it doesn’t really matter.  I made a choice that anything under 1 volt was going to turn something on, and any thing above 1 volt was going to turn that off.
Like I said there are probably a dozen of different ways to use these, that just seemed to be the quickest way.

20140506 Arduino VGA Out

May 6, 2014
Arduino VGA Out, one of the many things I randomly see as I roam the internet. This is kind of a neat project, and it does work, and it was pretty simple to hookup even thou there was an error in the documentation.  I do have to say that couple of the sketches on the google code site didn’t work. I’m not sure if they are works in progress or what.  That being said, the project did as expected and outputed a display on a VGA monitor. Here is the link to the project,
https://code.google.com/p/arduino-vgaout/ It seems there hasn’t been an activity on the site since June of 2013, so I don’t know what the current status is.  I also had to do a little digging to find what pins on the arduino this uses. And pictures of someones completed setup can be found here (It looks like he was using a 2011 version):
In the schematic, he also points out that PIN 9 shouldn’t be hooked up on the VGA connector, PIN 5 and PIN 10 should be ground, there was an error in the original schematics that are still on the google code site.
Quite a bit more information can be found on the Arduino forums:

I was going to chop up an old VGA cable to make this when I found that MCM electronics have this (and it’s only $4.50) and since I wanted to be sure I got the right resistors for this project I was already going to make an order, seemed like a no brainer:


VGA to Screw Terminal Module - MCM Part #: 83-12821

It probably ending up saving some build time, thou how much would be debatable.  So here are a couple of pictures of my setup:



So as you can see, it’s takes up a lot of pins, all of the analog pins, and 2 of the digital pins.  The digital pins are used for HSYNC and VSYNC, the analog pins are used for RGB, each color channel takes two pins, and each have a 1K and 470ohm resistor wired up. And yeah, I went a little nuts with the size of the resistors, I wasn’t really thinking about it at the time I ordered them, oh well, they were cheap something like $0.70 for 10 of them.
I probably need to trim up the resistors a little, but what the heck it works, and it will be one of those projects that I can say I did it, and now it’s in a box… :-)

20140424 DHT11 Humidity and Temperature Sensor

Apr 24, 2014
DHT11 Humidity and Temperature Sensor.  This is a fairly simple device, very simple really.
It uses 1 wire, and VCC & Gnd - Works at either 5v or 3.3v, and is slow as compared to some of the other temperature sensors. There is no calibration to it, pretty much plug it in and take a reading. It could take up to 2 seconds before a reading happens thou.  
Adafruit has a lot of information about this sensor, and it’s bigger brother DHT22 (they work the same way, the DHT22 is a little faster, and more accurate)
Adafuirt also has a DHT library which makes it even easier to use this device.

OH BTW The pull up resistor is not as necessary as it might seem to be (it works without it) -That bit of information came from a Teensy forum, Teensy seems to have some timing issue with it thou and it doesn’t work as it should with out a lot of modification of code with the Teensy 2.0 - IT apparently works just fine with the Teensy 3.0 using the default settings in the Adafruit library

20140420 Nokia 5110 LCD with Arduino

Apr 20, 2014
Nokia 5110 LCD with Arduino.

Not going to go too much into how this works, mainly because I’m not 100% sure myself.
Also not going to post a lot of code, because this device is very well documented. I will give links to Sparkfun and Adafruit, both with contain a lot of information about the LCD.  
Sparkfun, only uses the SPI Library, which is interesting, you will see in the code alot of HEX, which is how the display gets its commands. From what I can tell, the screen is not true SPI - but it close enough that the SPI library doesn’t have a problem with it. I think Sparkfun contains more information, or at least better information about this device.
That being said, Adafruit developed a ready to use library - and from what I can tell they are making the display work a little different then how Sparkfun did it. The library does make it a little nicer as well, since you can just call what you need, there is still some HEX to do graphics, but it looks like that is if you are doing a custom graphic, standard things like lines and circles, squares are all handled by the library.  There demo program is better as well, shows off more of what the display can do. So to sum up -
Sparkfun has better information, but Adafruit has a better library and program.
Here’s some links:

Stolen (don’t say that too loud, but I think we are aloud to use them) from the Sparkfun site:


Apr 4, 2014 - Using a 74HC595 8 Bit Shift Register with a 7 segment LED and Arduino

Apr 4, 2014 - Using a 74HC595 8 Bit Shift Register with a 7 segment LED and Arduino

A Better Example of using a 8 bit shift register (74HC595) with 7 segment LED - I got it working


int dataPin = 2;
int latchPin = 4;
int clockPin = 3;

byte dec_digits[] = {0b10000110,0b01101101,0b1001111,0b01010110,0b011011011,0b1110011,0b00001110,0b11111111,0b01011110,0b0111111 };

void setup() {
 //set pins to output so you can control the shift register
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 pinMode(dataPin, OUTPUT);
}

void loop() {
 for (int numberToDisplay = 0; numberToDisplay < 10; numberToDisplay++) {
   // take the latchPin low so
   // the LEDs don't change while you're sending in bits:
   digitalWrite(latchPin, LOW);
   // shift out the bits:
   shiftOut(dataPin, clockPin, MSBFIRST, dec_digits[numberToDisplay]);
   //take the latch pin high so the LEDs will light up:
   digitalWrite(latchPin, HIGH);
   // pause before next value:
   delay(1000);
 }
}

4/1/2014 HC-05 Bluetooth device

Apr 1, 2014    HC-05 Bluetooth device
At the 1st meeting I attended Jim gave me a blank holder for the HC-05 Bluetooth device, I was able to solder a HC-05 to it today, and it worked well.
The HC-05 bluetooth is a surface mount style device, and that can be a little scary for people.
They are cheap enough, and the blank is cheap enough I figured if I messed it up I wasn’t out much.  You aren’t saving yourself much by soldering your own to the blank (I think .30 or .35 cents, spend the extra money and get one already mounted).
I used the “drag” method of soldier, which is only one method for doing surface mounts, but I’ve got to say, it was easy to do, and it works, and it works well.

You’ll see in a couple of the pictures below that I didn’t get every pin, on this it doesn’t matter, I got the pins that are connected and as I said the bluetooth does work well.



3/22/2014 Cheap FS100a 433 Mhz Transmitters Revisited


Mar 22, 2014  CHEAP FS1000a 433mhz transmitters revisited,

Hooked up two transmitters and one receiver.  One Arduino was set to transmit “hello #1”, One Arduino was set to transmit “hello #2”, and one Arduino set to receive, Seems to work fine!

here’s a video:


So I was giving it the worse case, and the best chance to fail, and it seemed to work. By that I mean, both transmitters were right next to each other, the receiver was only a less the a foot away, and I put antennas on everything.
I don’t know for sure, but I had suspected this would work. I think it’s because of the modulation type, but I’m not sure about that either (not 100% sure).  A lot of digital modulation types have built in error checking.  
These are cheap, and a cheap way to send low speed data around.