Tuesday, April 7, 2015

20140626 Make your own FTDI cable (CHEAP)

20140626 Make your own FTDI cable (CHEAP)
I needed a extra FTDI cable, and I did find a cheap FTDI from China awhile ago, I think it was 7 bucks, about half of what everone else wants for a “real” FTDI. But I really don’t want to spend even this much for a FTDI.
This cable will cost about $3.50 but does require some work to make.
http://letsmakerobots.com/node/23728 It uses a CA-42 USB2.0 Nokia Data Cable, Seems like a lot of things for the old Nokia phones will work with our micro-controllers.  The link explains what you need to do, but in short, unsolder the wires that are on the chip, put 6 new wires on it, and solder pins to the end. And you have a DIY-FTDI cable for right around $3.50.
Drivers: Linux should have the drivers built in. For Windows you might need this:
Thou there is some debate on the website as to if this is the correct driver for the cable, you may have to hunt, but the drivers should be able to be found.
The best place to find the cable now is eBay:

IF making your own cable is not your thing then take a look at this:
FV88 FT232RL USB To Serial Adapter Module USB TO 232 Download Cable For Arduino
This is the chip that the FTDI is based on, I haven’t tried it yet, but looking at the pin-out of the chip it matches up to my $7 dollar FTDI, The biggest difference it seems this has male header pins, and most FTDI have female header pins, it’s even got a switch for 3v and 5v. Coming from China of course, but this seems to be the closest I’ve seen to a true low cost FTDI, order one and waiting. Cost $3.50, no work, unless you want to change the header out.

20140620 Doppler Radar Speed Detection using an HB100 10.525ghz radar gun.

20140620 Doppler Radar Speed Detection using an HB100 10.525ghz radar gun.

(I’ve updated this to a new library with better results, see below)

The HB100 is a 10.525Ghz radar gun, normally found in automatic door openers. But it can be used for other things.  
For most of the information I used to finally get this to work, I referred to the “Microwave Sensor Application Notes”
It contains all the information, radiation data, and circuit to amplify the output single.
The HB100 has an IF output frequency that is or should between 10hz and (say) 400hz.

It gives the formula to figure out Doppler frequency, which is
Fd = 2V(Ft/c)COS theta
Fd = Doppler Frequency, V = Velocity of the target, Ft = Transmit Frequency, c = speed of light (3 * 10^8 msec)
theta = the angle between the target moving direction adn the axis of the module.

IF the target is moving straight toward or away from HB100 (Ft = 10.525 Ghz) the formula is simplified to:
    Fd = 19.49V (Velocity in km/hour) or 31.36V (V in mile per hour)

So we are going to use the simplest of the two, we know the doppler frequency, and we want to find the speed.  
V = Fd/31.36 … What this really means thou, is for ever 31.36Hz will equal 1 MPH
So if the IF Frequency is 31.36 then the speed of the target is 1 MPH. Easy!

And a IF Frequency of say 400Hz would be about 13Mph if you round it up.

This was made even easier to find the frequency of the IF because I found a sketch that was a Frequency counter of sorts, and after the amplifier was built, I started to get some good speeds off the radar.
The FreqMeasure Library can be found here:
This was a hugh time saver, and it works very well.
You do have to approach the gun from head on, but it works and does a good job, and give speeds that I believe are very close to being right.  Over the next day or so I’ll try to get out on the road and see if I can get some real speed tests.
Video will be posted shortly.

Updated May 23, 2014: A new library and better results:
Found the above library from a link on the prjc website, this is apparently the library he based his library off of. What is interesting is I think I am getting better results from the original work then I was from the prjc libraries.
A couple of things, the library seems to be using 3 pins for input, and a couple of resistors,  but I found that with this doppler setup really only one pin was needed (as it was before) however it’s pin 7, a resistor doesn’t appear to be needed.  The library doesn’t have any “examples” to speak of, and the code that is on the site contains many errors (Yup, I spotted a lot of errors before I even got started)  I am thinking the code was written in pure C and the library was written for the arduino (maybe even an old version of the IDE)  It hasn’t been updated since 2012.

SO the code I came up with:

#include “FreqPeriod.h”

double lfrq;
long int pp;

void setup() {
Serial.begin(9600);
    FreqPeriod::begin();
    Serial.println(“FreqPeriod Library Test”);
}

void loop() {
    pp = FreqPeriod::getPeriod();
    if (pp) {
        Serial.print (“period: “);
        Serial.print(pp);
        Serial.print(“ 1/16us / frequency: “);

    lfrq = 16000400.0 /pp;
    Serial.print(lfrq);
    Serial.print(“ Hz “);
    Serial.print(lfrq/31.36);
    Serial.println( “ Mph “);
}
}

This library is a lot faster then the FreqMeasure library (which seems to be taking an avg over a period of time and giving back a freq.) This one seems to just spit out freqs. So it seems like it’s a lot more sensitive to changes.  In fact as I approve the  doppler even from the back side of it, I get a change on the screen.  Good/Bad??? I’m not sure of the answer.
The speeds seem much more reasonable as well, and perhaps that is the math using the double integer, perhaps that is the fact that I am dividing the HZ / 31.36 (which is the real number to use)

Thou, I have notice that using this Doppler Gun, and the fact that it is not very directional is a problem for doing any real speeds off it.

The other thing to note is that with this library my range seems to have increased, I am thinking this might be because it’s not trying to take an average and is just spitting numbers out as things change.

I am going to do a new video with the updated library.

20140525 - Hot Wheels 10.525ghz radar gun - Update #2

20140525 - Hot Wheels 10.525ghz radar gun - Update #2
The above website takes apart one of the Hot Wheels radar guns, and has some great pictures of the components. Something that you might notice is that the gun itself is very much like the little gun we have.  The biggest difference is it’s in a waveguide that helps to direct where the radar signal goes. But otherwise it is very much like what we have.  
One other thing you’ll notice is that he also had to add an amplifier to get a signal he could use, I believe that there is an amp on the “control board” but it may not have been easy to access that.
You’ll also note that his IF is also in the 10Hz to 150Hz range, which makes believe the hot wheels gun is using the HB100 or at least something that is very close to it.

There are quite a few projects that are using the Hot Wheels gun, including a Weather Radar (well sort of),
Does make me wonder if we could use what we have an mirror the above project, looks like it might be a big project.
And here’s someone that “made” a speed gun out of the Hot Wheels radar gun (What, this is already a speed gun???)

To make a real gun, we need more power which we are limited to using this unit. But we might beable to focus the waves better using something like this: It’s a 10ghz (X-band) radar cone, it’s tuned for the X-Band, and will direct the waves much better.  This is very much like what is in a commercial radar gun (IF the cops were still using X-Band)
It’s still not going to be perfect, not with this unit, but it will be better.

I would like to try to tune the gun, but for that we need tuning forks (Any should work, I think) as long as we know at what Hz they vibrate. (IE: a fork vibrating at 200Hz should be about 6.3 or 6.4 MPHs  Hz/31.36 = MPH) Short of having any tuning forks there is no sure way to know that what we are doing is working correctly or not.  

One Idea I have is to roll a hot wheels car, see what the hot wheels guns says, and then roll it again and see what our gun says. Hopefully they will be the same or close to the same - But that method has a problem that is the push was a little more or a little less then results would be a little different.  

SO if anyone has any tuning forks that we know the vibration of bring them to this Thursdays meeting and we will see if we can figure out!

20140519 2.4” TFT touch screen Arduino Shield

20140519 2.4” TFT touch screen Arduino Shield
The TFT touch screen arrived today, and I literally spent hours looking for the right library. I did find a library called “UTFT” or should I say an extension of “UTFT” that someone fixed, UTFT plus can be found here:
I found that using the “Uno” sketch included did work with the screen, I couldn’t get the touch screen or the SD reader working using this library.  And the sketch printed the letter backwards, like how it would look in a mirror.  So it was a start, but it’s not the right library for this display.

Finally I came across this video:
and they gave a link to some weird website that does have English, but it’s not the native language...very weird site:
Well sometimes you just have to put up with the weird sites. Found a library that WORKS! I did have to make a couple of small changes to the font library (been seeing this error a lot lately, not sure why, but the error tells me that something in the .h file needs to be setup as a const) So it’s a pretty easy fix.

At this point I still haven’t seen how to make the SD card reader work, but I’m ok with that. The library has two sketches, one is a touch screen paint program, and the other is just a long demo.

I’ll have a video posted in the next day or so, and I’ll also beable to see if or what it takes to make my own demo of the screen.


UPDATE: I put a library that does work with this screen in my google drive,
It was made for a older version of the IDE, gives an error but is an easy fix (off the top of my head I can't remember what that error is, or where it is at.  It is in one of the .cpp or .h files) It maybe the same error I talk about above.
https://drive.google.com/open?id=0B7GpAH3_kkRLSEk2Wm9HdGNGYTQ&authuser=0

20140513 - PWM Speech using an UNO

20140513 - PWM Speech using an UNO
So after playing around with the SID library, I thought what about speech? Well turns out, I’m not the only one to think of it, the the libraries were a little hard to find, because the one that everyone talks about is very out dated, and doesn’t work with any of the Arduino 1+ IDEs.
Even the one I finally found had a couple of small errors in it, but fixed almost all of the bugs from the original library.
It can be found here: https://github.com/jscrane/TTS
One thing that I had to fix was an error in the english.h file found in the TTS directory. The SoundData variable needs to be declared as a const, it was an easy fix. I did leave a message on github for the author of the library.
This library is based on what Clive Webster did, and was ported by Gabriel Petrut. And Stephen Crane modified it more so you can change what PWM pin it uses (a very nice feature to be sure).  So anyways, it’s a pretty simple library, set which pin you want to use.
the other commands as far as I can tell are.
setPitch, and sayText
It uses Timer1 to generate the PWM, and you need an amplified speaker with a good filter - mine works, but the filter probably could be better.
Video will be posted shortly, but this sounds very much like my SpeechJet/Robovoice chip (which was/is also using PWM to generate the speech.) The Robovoice chip is a PIC microcontroller, and has all the phonemes pre-programmed on it.  The arduino uses the english.h file for it’s phonemes,  and I think there maybe an error or two in a couple of the phonemes, but I can’t say for sure.
Anyways, video is coming.

May 11, 2014 - SID Arduino Library
Today while looking for some interesting projects, I stumbled upon.
https://code.google.com/p/sid-arduino-lib/ It looks like it might be abandoned project, but there is enough there to get going.
So this is really simple to hook up, PIN 9 to one side of a speaker, and ground to the other side of the speaker. I used one of my little speakers out of a old Dell computer so it was amplified, and needed to be connected to 3v, no big deal.
Figuring out some of how the sketches worked was a slightly different problem, but after I figured out one song, it was fairly easy to create others.  The library can handle up to three “Channels” or “voices” thou I haven’t figured out if each channel can have a different waveform, like the C-64 could. And getting some of the timing issues right were a little weird.  In fact the timing really kind of had the opposite effect as what was expected. And what I found out was that there is a type of sustain and decade on the waveforms, and that ended up being the trick to get some music working, I would need to hit a note, wait (delay) and then tell it to or force it to play freq 0.00 which can’t be heard, thou on one of the songs I did I did get some clicks, not a big deal.  
So I have a video coming, but it might not get done this week.  Overall thou, this was one of those quick and fun projects, that didn’t really need anything other then a board and speaker to work. 



20140508 BMP180 Digital Barometric Pressure Sensor

May 8, 2014
BMP180 Digital Barometric Pressure Sensor
Once again the folks over at Sparkfun out do the folks at Ada Fruit - Starting to worry about the people at Ada Fruit they are slipping alittle.  LOL
There is more information about this sensor then I could possibly give you, they even go into what pascal are (Pa, Basicly it’s a measure of force per unit area, defined as one newton per square metre - You get all that...yeah, see Sparkfun explains it beter)
The device that Sparkfun has is different, from what the club has, but it’s almost the same, it’s close enough that their tutorial works really well.  The sensor on it is the same sensor that on the clubs BMP180.
The device is an I2C device, it is very easy to hook up. SDA, SCL (Data and Clock), 3.3v and ground, that is it.  On the UNO it’s SDA to A4, SCL to A5
The other VCC connector on the board is for voltages lower then 3.3v



alt text
Ada Fruit does have plenty of information about this sensor as well, and their sensor looks more like what the club has.

The problem I had with Adafruits was the sketch didn’t seem to give as much or as good information as what Sparkfun did.
weather_bmp085_bb.png

Adafruits also requires one extra library which wasn’t included in the download package provided, that caused an issue for about 2 mins until I realized it called a different library.  Not sure why they did that, but after I got the 2nd library it did work, just didn’t seem as good as Sparkfun.
The outputs from the sensor, are Pressure, Temperature, and Altitude (Altitude can be both above sea-level and as a relative from it’s starting point), this is a very cool sensor, and with the addition of the humitdy sensor and maybe a wind speed sensor, this could be a complete low cost weather station. 

 https://www.sparkfun.com/tutorials/253

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.