Monday, June 28, 2010

R7000 refurb finished























After about six months of sporadic cleaning and testing the refurbishment project on my R7000 finally came to a close yesterday. The small tiltover mast has been rotated through 90 degrees to allow the antenna to "walk down" into the garden, and the meteo equipment has been moved onto a stand-off bracket about 1m down from the top to keep it clear of the radials.

Aside from testing resonance of the traps (vaguely inconclusive) I have not had chance yet to air test, mainly as I will need to replace or radically extend my primary coax run to reach the antenna - as although the antenna is only about 15m from the house the coax will probably now a total run length of about 65m to avoid cutting across the drive and patio. I plan to run up a few meters of coax later today and check how it loads up on each of the bands.

Still to do: Add some guy lines (its windy here!) and seal up all the joints with self-amalgamating tape once Im sure its resonant in the right parts of the bands.

Thursday, March 04, 2010

Duh!

Well, it seems you read my blogs more closely than I do!

Ive just had a mail from a friend pointing out that telling you to keep an eye on Emilys' weather blog, and then not including the URL does make it unnecessarily hard. I know some of you like a challenge, but I conceed that I perhaps should give it ;)

http://myweatherblog.wordpress.com/

As for infrequent blogging... Normal service will resume shortly, when work and my current OU commitments return to a more normal level.

Sunday, February 07, 2010

Hot off the press - NOAA15 pass @ 16:00 UTC today, our first test image off the WX Sat system :)

Keep an eye on Emily's weather blog for lots of further updates.

Monday, December 28, 2009

gMFSK getwx - a more finished script :)

Well... I didnt expect this to be quite so popular :) I woke up to a full inbox this morning - hard to believe so many people found the script so quickly.

OK, I realise that not everyone who uses gMFSK is a php programmer, and somne people are a little wary of editing the cron tab, so Ive written out a script that does everything - ie: it checks if there is a recent local copy of the RSS xml and builds the weather data from that - only downloading from yahoo if more than 30 minutes (by default) have passed.

Ive added lots of comments so as a combination of the new script and reading the previous blog entry it should be very clear how this works. I hope it will lead you on to a bit more experimenting with other on-line RSS sources you may want to use.

enjoy:


#!/usr/bin/php
<?
/* gMFSK getwx::

A simple script to grab your local weather from the web to insert into F-key
macros in the same way as $mycall $yourcall etc.

This is a slightly more finished version of the test scripts recently published
on my blog. This version checks if it has a local copy with a recent datestamp
of the RSS data from yahoo - then builds a complete weather report from the cached
data to save hitting yahoo every time the script is called.

Yes it could be done more easilly using cron, but feedback from some users
has suggested that a self contained "easy" script is wanted

Yes I could have used CURL - but a basic php_cli install doesnt always have
CURL compiled in.

to get the right url for your local yahoo weather vist weather.yahoo.com
type in your location and hit return. When you get your local weather click
on the orange RSS button and make a note of the URL. its the p=XXXXXXXXX bit that
is important. Changing the u=f to u=c gets you metric results

You need php_cli installed for this script to work eg: sudo apt-get install php5_cli

save this script to your gMFSK directory, remember to chmod it +x to be executeable

in one of the gMFSK function key windows add the command:

$(/home/g7nbp/gMFSK/getwx)

Remember to alter your path to point at wherever the file is saved.


Please feel free to experiment :)

Written by g7nbp 28-12-2009
*/


// OK first a few variables
$pageurl = "http://weather.yahooapis.com/forecastrss?p=UKXX1012&u=c"; // url of yahoo weather RSS feed
$file = "wx.xml"; // the file to save the xml to
$update_time = 1800; // period between getting updates down in seconds



if (file_exists($file)){

// the wx.xml file has been found :)
$fileage = time() - filemtime($file); // workout how old the local copy is
if ($fileage >= $update_time){
// local copy older than update_time - call the get_xml routine to read from website
get_xml();
}

}else{
// no the wx.xml file has not been found (first run??) so call the get_xml routine
get_xml();
}

// OK assuming nothing broke we can now work with the local copy :)


$rss = simplexml_load_file($file); // open local copy

// Build the variables from the assorted yweather:something namespaces
$condx = $rss->xpath('//yweather:condition/@text');
$condx = ltrim(rtrim($condx[0])) ." ";

$pressure = $rss->xpath('//yweather:atmosphere/@pressure');
$pressure_units = $rss->xpath('//yweather:units/@pressure');
$pressure = ltrim(rtrim($pressure[0])) . $pressure_units[0];

$temp = $rss->xpath('//yweather:condition/@temp');
$temp_units = $rss->xpath('//yweather:units/@temperature');
$temp = ltrim(rtrim($temp[0])) ."°". $temp_units[0];

$windd = $rss->xpath('//yweather:wind/@direction');
$winds = $rss->xpath('//yweather:wind/@speed');
$wind_units = $rss->xpath('//yweather:units/@speed');
$wind = ltrim(rtrim($windd[0])) . "° ". ltrim(rtrim($winds[0])) . $wind_units[0];

// finally build our output string

echo "local WX: Temp=". $temp . " Pressure=" . $pressure . " Wind=" . $wind . " Condx=" . $condx . "\n" ;

// --- thats all folks! ---


// functions live here

function get_xml(){
// a really simple file_get file_put routine to grab a copy of the weather XML
// and save it local to save hitting yahoo every time time we run the srcipt
global $file, $pageurl;
$xml =file_get_contents($pageurl);
file_put_contents($file, $xml);
}

?>


Sunday, December 27, 2009

gMFSK enhancements:: WX report... and beyond

Hi All...

Its been a while since I last blogged, but feeling suitably pleased with my recent efforts, so its time to blog :)

A while back I noticed that some PSK31 contacts have included automatic weather data, data from qrz.com, data from all over the web in fact. I wanted to add similar functionality to gMFSK

I noted that gMFSK (others will probably work too!) allows a shell command to be run as part of the macro system assigned to the function keys - extending the usual $mycall $yourcall syntax as far as you care to imagine. This is the way in :)

Basically to run any other command in gMFSK the syntax is $(/path/to/the/app)

So... after a bit of digging I found that the yahoo weather xml call brings back the data Im looking for (temp, pressure, wind and a description) and although it uses some extended xml namespace synatx is very easy to parse. I quickly wrote some test apps in php (yes I could have written them in C, perl or any other lang, but php makes this type of rss scraping easy and its what Im most fulent in).

(The reason for deciding upon yahoo by the way is that they change their XML far less frequently than other well known RSS feeds)

Basically the test scripts drag back the rss page from

http://weather.yahooapis.com/forecastrss?p=UKXX1012&u=c

which is my local weather station. To find the url for yours visit http://weather.yahoo.com/ type in your location into the city or zipcode box, and then click on the orange RSS feed button on the right and note the url of the rss feed. The important bit is the p=XXXXXXXXXX bit. You may want to change the final u=f to u=c if you want mainly metric results.

If you view the source of what comes back you will seethat most of the required info is there for the taking, if you can manipulate the

<yweather:wind chill="1" direction="260" speed="14.48" />

colon extended namespace format.

I wrote 4 test scripts for temp, pressure, wind, and conditions using php (If you dont have php-cli installed you need to add it - debian / ubuntu / similar systems can simply run
> sudo apt-get-install php5-cli

to add php script support without the need to add all the apache libs etc)

Each script calls the web page direct, but this is of course wasteful as the data is only updated every 30 mins or so. Most users will want to modify the scripts to point at a local version of the data and cron an hourly download, but thats up to you to work out ;)



temp::
#!/usr/bin/php
<?
$rss = simplexml_load_file('http://weather.yahooapis.com/forecastrss?p=UKXX1012&u=c');
$temps = $rss->xpath('//yweather:condition/@temp');
$units = $rss->xpath('//yweather:units/@temperature');
$temp = ltrim(rtrim($temps[0])) ."°". $units[0];
echo "T: " .$temp;
?>


Pressure::
#!/usr/bin/php
<?
$rss = simplexml_load_file('http://weather.yahooapis.com/forecastrss?p=UKXX1012&u=c');
$pressures = $rss->xpath('//yweather:atmosphere/@pressure');
$units = $rss->xpath('//yweather:units/@pressure');
$pressure = ltrim(rtrim($pressures[0])) . $units[0];
echo "P: ". $pressure;
?>

Wind::
#!/usr/bin/php
<?
$rss = simplexml_load_file('http://weather.yahooapis.com/forecastrss?p=UKXX1012&u=c');
$windd = $rss->xpath('//yweather:wind/@direction');
$winds = $rss->xpath('//yweather:wind/@speed');
$units = $rss->xpath('//yweather:units/@speed');
$wind = ltrim(rtrim($windd[0])) . "° ". ltrim(rtrim($winds[0])) . $units[0];
echo "W: " .$wind;
?>

condx::
#!/usr/bin/php
<?
$rss = simplexml_load_file('http://weather.yahooapis.com/forecastrss?p=UKXX1012&u=c');
$condx = $rss->xpath('//yweather:condition/@text');
$condx = ltrim(rtrim($condx[0])) ." ";
echo $condx;
?>


You need to mod each of the scripts to be executable via chmod +x and save to the gMFSK dir in your homedir.

Each script can be tested on the command line.

Finally you need to add them to gMFSK. In my case Ive added a combined wx macro to F12:

WX: $(/home/chrisw/gMFSK/condx) - $(/home/chrisw/gMFSK/temp) $(/home/chrisw/gMFSK/wind) $(/home/chrisw/gMFSK/pressure)

(change chrisw to whatever your homedir is!)


Hitting F12 now of course brings back to the TX window:
WX: Mostly Cloudy - T: 4°C W: 290° 8.05km/h P: 982.05mb



As commented, each script hits yahoo for about 1k of data so while this inst a huge amount, its not very sporting every QSO so consider using a wget script from the cron to grab a local offline copy of the page and parse that rather than hitting the web every time!

Hopefully that provides some inspiration for others to go on to explore other dynamic data includes in gMFSK from not only yahoo weather, but the whole of the net :)

Thursday, March 26, 2009

after the dweenotalk..

Im just having a cup of tea before bed,so a few moments to reflect on the talk I delivered tonight - an intro to Arduino.

Its a big subject arduino, hard to cover in a short talk. Intros always tend to just scratch the surface, and in-depth talks tends to lose people on the bottom end of the learning curve too quickly. I tried my best to pitch tonights talk somewhere between those extremes, but I wonder if something got lost, or at least watered down in the process. You cant be all things to all people all at once.

My delivery wasnt very polished either, mainly because I just had to throw the material together at a run. Some stuff could have had less detail, other stuff needed more. Its always hard to gauge this till you have run through it a few times.

Oh well... It will be better next time. On the whole though I think tonight was a useful talk for most people. feedback was good. Im pretty sure most people learned at least what arduino is, and what it "could" do for them if they start on the learning project - which of course was the purpose of the evening. I think I got over the enormous flexibility and power of the platform, and also the relative ease of getting onto the ladder - something that other platforms cant compete with. I think the main selling point for most people was when the notion clicked home that you can take a few other bits of hardware and quickly glue them together with a few lines of code and pow! you have a remote ATU,or an antenna analyser, or even just a device that flashes a few LEDs

Time will tell. Success will be measured in how many people actually take onboard the project and experiment :)

Dweeno talk tonight!

Tonight Im giving my Talk on Arduinos and introducing the club Arduino project, so I had planned a day in the office to finish off the powerpoint presentation and sort out the arduino sketches for tonight. But... so far its not been quite the start to the day I had expected.

First call of the day has been a trip up to the repeater to re-set the logic... again... so now its 10:07. Ive got a brief bit of work to do mid day too. So a chunk of the day has gone already. No time for blogging really, but I am updating a couple of other info and security sites and blogs, so a quick diversion via here wont really hurt much. Then I really MUST get on with stuff, or there wont be a Talk tonight!

Anyway, my main reason for stopping by is to add a quick post pointing to my new storytlr site - http://chrisjw.storytlr.com which has replaced my old swurl space. Its another stream aggregation system pulling some of my assorted public feeds into one spot. There probably wont be a huge amount of stuff of extra interest there - basically it currently has this feed, twitter status, tumblr pix uploads and blog, my other chrisjw - random thoughts blog (life linux and other geekishness) plus pictyre feeds from picasa and flickr. Oh... and possibly of a little more interest my public bookmarks from delicious. Hopefully storytlr will be a longer lasting replacement for swurl.


I will add a posting later with links to the arduino talk info.

Thursday, February 12, 2009

and the other reason for little dweenofurkling is...

and the other reason for little dweenofurkling is... Im just so damn busy with work. Ive still not caught up with all the work I missed over the Christmas break while I was recovering from surgery, and three of my main clients all want me to be doing some fairly major updates right now.

That said, I have found time to start experimenting with the I2C phase of the arduino +DDS project. Basically by the time you have got the DDS60 board and a jog shuttle dial onto the arduino, you are running low on IO pins - the answer is I2C. (yes pix when I get chance!)

Ive used the BV4218 board from ByVac to add a 4x16 char LCD and a keyboard using just two lines from the analog port using the 2 wire lib. Its a great way of saving around a dozen pins. (its well worth a look around the other I2C products from ByVac too)

Im also pleased to report that the Arduino DDS project won first place in the construction competition at Salop Amateur Radio Society tonight too - despite being only proof-of-concept level boards up against some quite stiff competition. (photos will follow)

Too late for more comprehensive updates right now, I will make up for the lack of recent blogging over the next few days once sanity returns to working hours...

Sunday, January 18, 2009

UNR - the reason for little dweenofurkling as of late

Most of my time over the last few weeks has been taken up with catching up with work and also installing Ubuntu UNR - the netbook remix onto my Acer AA1 and Lyns EeePC701 - so other projects have taken a bit of a background place.

Ive added the arduino IDE onto my AA1 - what an amazing dev tool it makes - ultra portable dweenofurkling!

Full details on one of my other blogs :

http://chrisjw.blogspot.com/2009/01/eeebuntu-unr-on-basic-asus-701.html
http://chrisjw.blogspot.com/2009/01/rip-linpus.html
http://chrisjw.blogspot.com/2009/01/some-unr-screenshots.html
http://chrisjw.blogspot.com/2009/01/more-screenshots.html

DDS60

Just a quick update - I finished building another DDS60 board last night and am now designing a new proto-shield that will accept the DDS60 and will incorporate the jog/shuttle design and also an LCD - essentially a complete 0-60MHz VFO system with direct frequency readout.

Full details will follow.

Sunday, December 21, 2008

Jogging and shuttling with Arduino.

As those who follow my dweenofurkling antics will be aware, Ive recently started experimenting with DDS VFOs (Direct Digital Synthesis Variable Frequency Oscillators) Ive been looking at the AD9851 from analog devices.

One of the easiest ways of building and experimenting with this device is via the DDS60 board from AmQRP This simple board just needs power and a serial data source. Unsurprisingly I plan on using an arduino to provide the correct data-word corresponding to the required output freq. A lot of the groundwork has already been tackled by others - Marxy has a good writeup on his blog which has formed the basis of quite a bit of my experiments to date. My contribution to the cause is towards practical real-world use of the DDS system. Link

The DDS itself has a frequency range of 0-60Mhz, in 1Hz steps. With such a wide range what would be really handy is the ability to scroll thru a wide range of frequencies rapidly, slow down, then fine tune over a few hertz. A combination of Keypads, up down buttons and rotary encoders are the usual method of changing frequency, combined with an LCD frequency readout. All work fine, but are really rather clunky methods of navigating up and down a wide range of frequencies, but with good fine tuning accuracy.


There is however a device that make this sort of thing really quite intuitive - the Jog/Shuttle Dial

The jog/shuttle dial has an outer ring which allows you to rapidly select +/- movement (usually of position within multi-media) with center stop. The greater the deflection, the higher the rate of change. The inner wheel with finger hole spinner allows fine tuning up down depending on direction of rotation like a conventional rotary encoder.

This type of control features occasionally on high-end radio transceivers for VFO control, but is usually well beyond the means of the typical home constructor. Partly because of cost, and partly because of the complexity of interfacing. HOWEVER!! these days that doesn’t have to be the case :)

The following few blog entries describe my tests interfacing a jog/shuttle control to an arduino for use with the DDS board. Hopefully others will find the tests useful and will incorporate this useful control type into other radio and electronic projects.

So, first things first - where do you get a jog/shuttle control?

Well. You can of course buy one, ALPS make them. Several suppliers stock them. The usual problems of minimum order quantity and cost are however factors to consider here - they are expensive items. There is however a fairly reliable source of jog/shuttle dials available second hand - as long as you dont mind a bit of disassembly to get at them. I refer of course to their use in video recorders. Quite a range of "pro-sumer" grade VCRs sold over the last 10 years will have featured a jog-shuttle dial. Ebay, junk stores and swapmeets etc are a good source.

Another place you may find a jog shuttle dial is on the remote control that went with the VCR - which is where I got the one Im experimenting with. (There are a couple of sellers on Ebay who sell just remotes - and the one I bought cost me about £12).

The case on this one had the usual single screw and snap fit casing lugs, so it was on the bench and plugged into the logic analyser within a few minutes of it arriving in the post.

Bench testing the control

I connected up the remote to a 3v supply via the battery terminals and tacked on some breakout leads to the switch connections to connect up my logic analyser.

The pinout was thoughtfully printed on the reverse of the PCB. I expected to find a simple two-pin-plus- ground AB quadrature system for the jog dial (as denoted by J1/J2, with 0v via C2) and 4 other pins plus 0v common C1 giving a grey coded binary output from the shuttle ring, and this seemed to be confirmed by the pins.



Each pin is pulled high via a 5k res and gives conventional high/low output
.


Firstly I decided to check that the jog dial was as expected - plain old 2bit greycoded quadrature.

Yup, fairly conclusive. I did however note that sometimes the jog dial would produce two transitions per click on the dial, and sometimes only one.












There doesnt seem to be any specific pattern I can find to this, it does just seem to be that the detents are just in unfortunate places. The mark and space ratio was also rather variable, especially when spinning at speed.
So far, so good.... So what about the shuttle dial? Slowly rotating the shuttle dial gave the expected single bit change at about 10 degree steps. Building a truth table took just a few moments.
(God knows how I used to do stuff like this before I had a logic analy
ser - perhaps I had more patience then!)


As expected, only a single bit changes for each step, all the clockwise positions resulting in an odd number, all the anti-clockwise positions resulting in an even number. Not too difficult to match up to either an array based lookup or some bitmath.




So, now its time to warm u
p the soldering iron again and make up a test rig :)

I carefully removed the control and placed it on a scrap of veroboard and added some 90degree header pins to make plugging it into a breadboard a bit more easy.

Although I could have used the on-board pullup resistors on the arduino board I opted to add pullups to this board as it could then be used stand-alone with my logic analyser and scope etc too.












Here we see the control in place in the breadboad connected to arduino and laptop.


Software:

As with the hardware tests I decided to start with the jog dial first. Initially I checked that I could actually see the 2bit grey code states change as I spun the dial. Once I had verified I could actually see the states I wrote this small test sketch:


-----------------------------------------

/*
Jog test - 1

(a minimal quadrature type decoder for jog dials)

*/

int clock = 6; // Define encoder pin A
int data = 7; // Define encoder pin B
int count = 0; // pre-init the count to zero
int c = LOW; // pre-init the state of pin A low
int cLast = LOW; // and make its last val the same - ie no change
int d = LOW; // and make the data val low as well

void setup() {
pinMode (clock,INPUT); // setup the pins as inputs
pinMode (data,INPUT);
Serial.begin (9600); // and give some serial debugging
}

void loop() {
c = digitalRead(clock); // read pin A as clock
d = digitalRead(data); // read pin B as data

if (c != cLast) { // clock pin has changed value... now we can do stuff
d = c^d; // work out direction using an XOR
if ( d ) {
count--; // non-zero is Anti-clockwise
}else{
count++; // zero is therefore anti-clockwise
}
Serial.print ("Jog:: count:");
Serial.println(count);
cLast = c; // store current clock state for next pass
}
}

-----------------------------------------

None of that should need much explaining, the comments cover pretty much how it works. In an ideal world I would have the polling replaced by interrupts, but as a test for now it seems fine.























As can be seen from the screendump, it was fairly easy to make a running count which was increased and decreased by spinning the jog dial.



Next I wrote a small sketch to work with the shuttle ring.


-----------------------------------------
/*
* Shuttle test prog -1
*/


// define grey code positions stored in 0-15 array in global scope
int gray2pos[] = { -60,+50,-70,+60,-50,+40,-80,+70,-30,+20,-20,+10,-40,+30,-10,0 };


void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
pinMode(8, INPUT); // sets the digital pins as input
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
}


void loop()
{
Serial.print("Shuttle :: Bin:");
Serial.print(PINB,BIN); // scan PORTB (pins 8-13) and print as a binary
Serial.print(" Dec:");
Serial.print(PINB,DEC); // print the same data as a decimal
Serial.print(" Pos:");
Serial.print(gray2pos[PINB]);
Serial.println(176, BYTE); // extended ascii val to get the degrees symbol
delay(1000);
}

-----------------------------------------


This bit might need a little more explaining. As you can see from the sketch, I included an array at the top which held the 16 possible positions the shuttle ring could be in with its correct angle in the array position which correcponded with the decimal value of the 4 data bits from the switch - ie if the switch binary pattern was 0110 th at gives us a decimal value of 6 - so look in array position 6 and we find the value "-80" which indicates the switch was turned 80 degrees anti-clockwise.























The other bit thats possibly not clear right away is where I get this number from... well the easiest way to do quick bit bashing on an arduino is to read all the pins you want as a single port - ie to read each of the bits as its binary equiv. This is done using the PINB command. the B port is actually digital pins 8-13 but I am only using 8-11



So, now lets put both of those together

-----------------------------------------
/*
* Full Jog/Shuttle test prog
*/

// global scope vars
int clock = 6; // Define jog pin A
int data = 7; // Define jog pin B
int c = LOW; // pre-init the state of pin A low
int cLast = LOW; // and make its last val the same - ie no change
int d = LOW; // and make the data val low as well
int count = 0; // pre-init the count to zero

// define counter shuttle steps array
int gray2pos[] = { -64,32,-128,+64,-32,16,-256,+128,-8,4,-4,2,-16,8,-2,0 };


void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
pinMode (clock,INPUT); // setup the jog pins as inputs
pinMode (data,INPUT);
pinMode (8, INPUT); // sets the shuttle pins as input
pinMode (9, INPUT);
pinMode (10, INPUT);
pinMode (11, INPUT);
}


void loop()
{
checkjog(); // move each of the checks out to a function
checkshuttle();

Serial.print("Jog/Shuttle:");
Serial.println(count);
}


int checkjog(){
c = digitalRead(clock); // read pin A as clock
d = digitalRead(data); // read pin B as data
if (c != cLast) { // clock pin has changed value... now we can do stuff
d = c^d; // work out direction using an XOR
if ( d ) {
count--; // non-zero is Anti-clockwise
}else{
count++; // zero is therefore anti-clockwise
}
cLast = c; // store current clock state for next pass
}
}

int checkshuttle(){
count += gray2pos[PINB];
}

-----------------------------------------
and we end up with























And thats pretty much it really. Rotating the shuttle ring further produces a step size that gets progressively larger positive or negative. spinning the jog dial allows fairly precise setting of any value. As the detent clicks on this dial tend to be in odd places, Im tempted to modifiy the code so that it takes several clicks, possibly even a complete turn to increment the count by one. (simple adding of a fractional value and INTing the value could accomplish this).

As high speed isnt expected, its quite OK to use routines like the above, though use of interrupts will of course be a better option.

Its now a fairly simple matter to add this functionality to the exisiting DDS word gen code from the Marxy blog - though Ive just not had chance to start on this yet. Future challenges will however be ensuring that there are enough pins to drive an LCD display for output and the DDS serial stream.

More to follow when I get some more bench time...

Housekeeping...

Regular watchers of my assorted blogs will have noticed Ive had a bit of a tidy up. As my assorted blogs have covered travel, climbing, mountain biking, running, electronics and radio, astronomy, photography, family, and life in general some of the blogs have got a little dis-jointed and may not have been of interest to everyone all of the time. So it got to be time for a tidy up. Some stuff has been moved, some stuff that didnt have an obvious home has been removed. Hopefully the revised structuring will make a little more sense and will (hopefully!) be easier to stick to.

The G7NBP - Random noise blog continues to focus on experiments in radio and electronics, but now also encompasses some of my Arduino based experiments too, as they generally have relevance to more general radio and electronics hobby areas.

Other blogs and assoreted life streams are of course still being aggregated at my swurl site - http://chrisw.swurl.com/