Sunday, June 24, 2012

Controling the Kenwood TH-D7 from a PHP script

I was asked to write a blog post about the TH-D7 PHP script I wrote and posted about on twitter and youtube. One thing, all of my scripts were and are written for the command line, thou I see no reason why you couldn't use this script from a website, maybe with some slight modifications. You'll need to get the php_serial.class.php written by Rem Sanchez It can be found here: http://www.phpclasses.org/browse/file/17926.html This php script is the key to making the whole thing work, well at least it's one of the keys. The other the D7 and other Kenwood radios can be controlled from the serial port on the radio, you just need to know what to send to the port for the radio to do what needs to be done. For the command protocol you should look here: http://www.radiohound.com/command.htm So the basics: 1 include the php_serial.class.php 2 open the com port 3 send the command to the radio 4 Jump up and down because it worked! LOL It really is as simple as that thou. So, let look at my code, which is still very much a work in progress, sooner or later I will add/change the code so that it will ask the Freq or ask the message, at this time, it's hard written in the code, but it will give you an idea. CODE: D7.PHP require("php_serial.class.php"); $update = toserial($msg, "/dev/ttyUSB0"); function toserial($text, $comport) { //Initialize the class $serial = new phpSerial(); //Specify the serial port to use... in this case COM1 $serial->deviceSet($comport); //Set the serial port parameters. The documentation says 9600 8-N-1, so $serial->confBaudRate(9600); //Baud rate: 9600 $serial->confParity("none"); //Parity (this is the "N" in "8-N-1") $serial->confCharacterLength(8); //Character length (this is the "8" in "8-N-1") $serial->confStopBits(1); //Stop bits (this is the "1" in "8-N-1") $serial->confFlowControl("none");//Device does not support flow control of any kind, $serial->deviceOpen(); $serial->sendMessage($text); $serial->deviceClose(); return; } The above is will be called from the other scripts, it's meant to try and keep all the scripts small and easy to use, mainly what this script does is setup and send the command to the serial port. My FREQCHANGE.PHP $freq = '00144390000'; $msg = "FQ " . $freq . ",00" .chr(13) .chr(10); include ('d7.php'); OK, so here I set what Frequency I want to change to, you might notice how the frequency has leading zeros and trailing zeros, this is required by the radio, otherwise it's not going to work correctly. The $msg is what is passed to the D7.PHP script and is the command for the radio so if we look at the command protocol we will see that FQ is for setting the frequence and is in the form of FQ(space)FREQ,00 and a return and line feed need to both be sent I have two scripts setup for turning on and off the TNC of the radio as well, they are pretty much the same script: $msg = "TNC 1" .chr(13) .chr(10); //will turn TNC on $msg = "TNC 0" . chr(13) .chr(10); //will turn TNC off But again I refereed to the command protocol for those commands :-) of course the fun command is to send an APRS message! For that I wrote a short PHP script called: APRSMSGSEND.PHP $tocall = 'CALLSIGN-SSID'; $tomsg = 'Testing APRS Msg via script'; $msg = "AMSG 00," .$tocall . "," . $tomsg . chr(13) . chr(10); include ('d7.php'); SO as you can probably see by now, it's just setting the correct command to send to the serial port of the D7 $tocall call be a callsign or a callsign with SSID, and just remember the D7 is limited in how many characters it can send for the message SO, really the key to make this work is the serial port script! The D7 has a lot of other things that can be controlled via the serial port so I will refer you to the command protocol. My scripts are still very much a work in progress. Sooner or later I would like to make it look for key words off twitter probably just to change the freq, and I'll hook the audio up to a streaming service so people can listen in! :-) Other radios probably can also be controlled by this method as well, you just need to know the command protocol for your radio! Happy Radioing, and 73, LeRoy, KD8BXP

Thursday, March 15, 2012

How I did the Knight Rider Style LED Chaser using the basic stamp

So I was asked how I did the cyclon/knight rider stlye chasing LEDs using the basic stamp.
These two videos pretty much explain it, but I also said I would post the code, so here it is.






Cylon Chaser Lights:

' {$STAMP BS2}
' {$PBASIC 2.5}

HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
PAUSE 500
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
DO

HIGH 0
HIGH 9
PAUSE 50
LOW 0
LOW 9
HIGH 1
HIGH 8
PAUSE 50
LOW 1
LOW 8
HIGH 2
HIGH 7
PAUSE 50
LOW 2
LOW 7
HIGH 3
HIGH 6
PAUSE 50
LOW 3
LOW 6
HIGH 4
HIGH 5
PAUSE 50

LOW 4
LOW 5
HIGH 3
HIGH 6
PAUSE 50
LOW 3
LOW 6
HIGH 2
HIGH 7
PAUSE 50
LOW 2
LOW 7
HIGH 1
HIGH 8
PAUSE 50
LOW 1
LOW 8
HIGH 0
HIGH 9
PAUSE 50

LOOP

Knight Rider Stlye Chaser LED:

' {$STAMP BS2}
' {$PBASIC 2.5}

HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
PAUSE 500
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
DO

HIGH 0
HIGH 1
HIGH 2
PAUSE 50
LOW 0
HIGH 3
PAUSE 50
LOW 1
HIGH 4
PAUSE 50
LOW 2
HIGH 5
PAUSE 50
LOW 3
HIGH 6
PAUSE 50
LOW 4
HIGH 7
PAUSE 50
LOW 5
HIGH 8
PAUSE 50
LOW 6
HIGH 9
PAUSE 50

LOW 9
HIGH 6
PAUSE 50
LOW 8
HIGH 5
PAUSE 50
LOW 7
HIGH 4
PAUSE 50
LOW 6
HIGH 3
PAUSE 50
LOW 5
HIGH 2
PAUSE 50
LOW 4
HIGH 1
PAUSE 50

LOOP

Sunday, November 27, 2011

Why DuckDuckGo has it wrong!

Until Recently I have never heard of DuckDuckGo.com. It's a search engine that doesn't track you, or put you in a bubble. Sounds good right? Well, they got it wrong! They have an illustrated website called http://dontbubble.us on the website, they explain that other search engines will give you results based on other sites you have visited, putting you in a bubble, and not showing or showing results outside the "bubble" lower in ranking on the search results.
So I did a little test of my own. Now I am a big Star Trek fan, that's no secret. and I used the 3 big search engines, and DuckDuckGo.com, here are the pictures of my results when I searched, "Who is the better Captain?"






In the 1st picture you see the results of duckduckgo and google. In the 2nd Bing.com and Yahoo.com. I didn't say anything about which "Captain" I was looking for, it was a pretty generic question so just about anything could have come up in the search. Well with out tracking or putting me in a bubble, I get things like "Captain America or Batman" or "Dhoni or Dada", from DuckDuckGo, Bing and Yahoo. But Google putting me in a "Bubble" gave me results that are more suited to my interests. Namely "Captains from Star Trek" and then four or five results down the page I got the results that were like the other engines. In otherwords, google put what it thinks I might be looking for near the top of the results, based on websites, or other searches I have done, but it didn't exclude the results I wasn't looking for.
Where in duckduckgo I had to search the results for what I was looking for. I want to be put in the "bubble" I want results that are much more to my interests then non-relative results.

OK, so what are the results if I change the question "Who is the better captain Kirk or Picard?"






This time the results for all four virtually identical, and on Yahoo and Bing they appear to be identical. What does this prove? Well in my mind I can't just use a generic search on duckduckgo, I have to be pretty specific about what I am looking for. While on Google I can be a lot less specific about what I am searching for, and the results will be sorted in an order that makes since and still will show results that may or may not have anything to do with what I am really looking for.

Google has it right!

Saturday, November 5, 2011

Fringe or Grimm ?

I have been a fan of Fringe for sometime now, but this season just seems like a re-hash of season 1. And honestly I am loosing interest in the show. Last nights episode (Nov 4, 2011 - Novation) did bring some of the excitement back, and started to peek my interest again. Although, it really does seem like just a different take on Season 1.
In my own opinion, Fringe should have ended when Peter disappeared. The 1 observer said "He was never born", which would have stopped Walter from going to the other side to get Peter in the 1st place, and would have prevented the destruction of the other side. We did find out that Peter had been born, but died. One from the natural causes, the other because Walter did go over to the other side, and Peter drown this time, Walter couldn't stop it. Radon Lake is a focal point. So I still maintain, that in at least one of the universes Peter shouldn't have been born, and that would have prevented this whole thing to start with.

Last week, I saw a the season premier of Grimm, this is a modern day interperatation of the original Brother's Grimm stories (NOT the fairy tails, but the stories that the fairy tails are based on) While this show does remind me a little of "Special Unit 2", it does seem to have a different twist on that idea. I know that only 2 episodes have aired, but I am really starting to think this show may have to replace Fringe on my Friday nights. Seems to me that just has just the right mix of fantasy, sci-fi, crime-drama to make it a big hit. It even has a great back story that will keep me interested at least for the foreseeable future

Would love to hear the opinion of others on this.

Saturday, October 22, 2011

Don't Try this at home!

Not being able to wait till LinuxMint 12 (Lisa) was out in any form (beta/alpha/RC, whatever) I decided today I would just change the source.list repositories in LinuxMint 11 and do a distro-upgrade. Well, that worked.... sort of! Linux Mint 12
here is a picture of the login screen after the update:



The desktop, I had to select Gnome (NO effects) to get anything to work at all:




And the menu system:




NOW remember Linux Mint 12 is not suppose to be out until well into November, So what I got is not at all what LM 12 is going to be. I want to make that perfectly clear, I am one of those people that just can't wait. LOL

The good news is I didn't get Ubuntu/Unity - the bad news is I didn't get much more then a desktop.

So don't try this at home....but if you really want to try.

take a look at this post on the Linux Mint website this was written for LM 9, so you will need to change some things to the current distro names, but the idea is pretty much the same idea. Be sure to follow the instructions on the screen. And if it breaks your system, I said you really didn't want to try this at home!

It will probably break your system. Linux Mint even warns about doing it.
I guess I get to see over the next few days if I start to get a real Linux Mint desktop or if I just did this for no reason at all.

Have a great day.

Sunday, October 16, 2011

Linux Distro's you've never heard of!

Recently I've been looking for a different distro, because I really don't like the direction Ubuntu is going. And I've come up with a few distros I really like. But it doesn't stop there, I've been looking at a few distros that are not "top" distros, in fact a few of them I've never heard of before.

And while these are impressive, I really wonder why they have not taken off more!

1) Opengeu Linux http://opengeu.intlinux.com - This distro is very interesting, it is using Enlightenment desktop e17, It is based off Ubuntu, now here is the interesting part, at the time of this writing there are only 2 version available for download, LTS version 8.04.1 (Yup that's right from 2008), and "Luna Serena" ie: 8.10 Torrents are the best way to get this, I downloaded "Luna", more interesting, the "Latest version" is "Quarto Di Luna" ie: 9.10 Which doesn't have a download link at all. So it would appear the project is dead, BUT wait! If you click on the "news" link you'll find out that the creator of this distro is in the process of updating it. Sounds like the creator is also moving away from Ubuntu, and toward Debian Testing and E17 SVN + EFL beta 2/3. Here's the thing, if it never gets updated, it is still worth checking out. The last Enlightenment desktop I tried was nice, but didn't really have much to it, Not only is this desktop simple, and easy to use, it's jamed packed with features!
It's old in terms of linux distros, but I would check it out.



2) iGolaware - http://www.igolaware.com/ - This distro is a newer distro, based off Ubuntu, I think it's using 10.10, even thou it say's in the "about Ubuntu" 11.04 - it does almost instantly popup and tell you that 11.04 is available for upgrade. They are using Gnome 2.32.0 desktop,
A Cairo-Dock is on the bottom, It has a lot of apps preinstalled. Including Chrome, some HP printer tools, xbmc media center, Firefox is still v 3.6.13 and Chrome is v 8.0.552.224, it also has ClamTK Virus Scanner installed, it also has Play-On-Linux and many other programs installed. This is going to be one to watch, and see which direction it goes. Will it follow Ubuntu 11.10 or stick with a Gnome 2 desktop? These are the questions. Worth looking at thou!

3) Elementary OS - http://elementaryos.org - One of my friends turned me onto this distro, it was the 1st time I have heard of it, it was the 1st time he heard of it - Thou it's been around for awhile, so more people know about it then me LOL. This is a clean, Ubuntu based Gnome 2 distro. Using a dockly-dock, and lightweight apps. But this video can explain this distro much better then I can.

Saturday, October 8, 2011

Follow up on 19 different Linux Distros

Last month I did a review of 19 different Linux Distros. I came up with 5 that I personally really liked, so I asked my wife to install each one and play around with it. Let me say this, she has used Ubuntu before, but never installed it. Her level of knowledge is probably less then most Windows users. She knows how to get online, and look stuff up, watch some movies, that is about it.
So when I asked her to install and play around she wasn't sure she would know how to do it. I said that was kind of the point. I am experienced Linux user, so what I find easy may not be "earsy". This was a good test of the 5 distros I really liked, as to just how easy they were.

These are her notes NOT Mine:

Debian: I just pushed buttons didn't know what I was pushing but it would help if I understood it. It asked too many questions.

Linux Mint: Easy to install Didn't ask a lot of questions, installed quickly, desktop was easy to use.

OpenSuse KDE: Took too long to install. Didn't like it

(MY PERSONAL NOTE: This distro never actually loaded on the real machine, I'm not sure why, I have tried the DVD in another machine and it worked fine)

Pinguy: I like this desktop it was cool, It's like Linux Mint. Easy to install for someone who deosn't understand the words.

Arios: Install was easy except it made me hit the wrong number
(My personal note: She did miss a step twice on the install, but the 3rd time she got it. She wouldn't have if I didn't help thou, she was about to miss the step again.)

I had here install one more distro that I didn't review, Pardus - I found this linux after I did the big review, and decided that I did like it. So I had her try it out.

Pardus: Installing was easy but in the beginning there was some words I didn't understand. It has games, and the desktop was ok.

HER Favorites in order:

1. Linux Mint
2. Pinguy
3. Pardus
4. Arios
5. Open Suse KDE (She liked this more then Debian even thou it never did load up correctly on that machine ????)
6. Debian (She must have really not liked Debian, see the note above)