Junebug USB PIC Laboratory

Well, I thought I’d start an Electronics section on my little blog, for those of you interested in electronics as a hobby, or just wish to read a little about embedded devices, such as the PIC Microcontroller, to gain a little insight as to how they work. So, with the need to start somewhere, let’s start off by taking a look at the Junebug — a USB PIC programmer and debugger (ICD – In Circuit Debugger), from BlueRoomElectronics.com.

 


Click the image for a full size view

 

I’ve had my Junebug for just over a month now, and I love it. I also have the Inchworm+/Unicorn combo, but the Junebug is far superior, IMO.

Let’s check out some of the features of the Junebug;

PICKit 2 Compatible Programmer / Debugger & UART tool
1. USB-B connector, provides power and communication for the Junebug, Tutor & target projects
2. Programmer status Power, Target Power & Busy
3. PIC18F2550 preprogrammed with .hex
4. 18F2550 ICP, expansion & PK2 compatible
5. Tutor mode switch see page 6 for details
6. ICD programming / debugging connector (2×5 type)

Yes, the Junebug is a PICKit 2 Compatible Programmer / ICD and fully supported by the Microchip software. This means that you can use the Junebug anywhere the PICKit 2 is supported, such as MPLAB, MPLAB C18 and the PICKit 2 software.

Not only can you program a wide range of PIC products, you can also use the Junebug as an ICD (In Circuit Debugger). For those of you, like me, that can’t afford a hardware simulator, the Junebug is perfect!

Click here for a list of products
that can be programmed/debugged with the Junebug

 

OK, so you can program, and debug your target boards/PICs, what project or board should you build first? Well, why don’t you have another look at the Junebug — it’s much more than just “a programmer” — it’s also a complete development board suited for so many projects and applications, well, let’s just say it will keep you entertained for many, many hours, without building a single PCB.

Let’s check out a few of the features from the TUTOR side of the Junebug;

PIC18F1320 Tutor / Trainer
7. USER I/O connector U5V,RA1,RA2,RA3,RA4,RB1(TX),RB2(RX),GND
8. 38KHz Infrared detector / demodulator enable with DIP switch IR IN
9. Reset or RA5
10. CON4 A3,A4,GND socket designed for iButton® / 1-wire®, and various small parts
11. VR1 & VR2 variable resistors on RA1 & RA3 (DIP switch selectable)
12. Six multiplexed LEDs
13. Pushbuttons on RB0, RB2 & RB5
14. PIC18F1320 for user programs and software development
15. CON5 designed for buzzers, servo motors, PWM and general I/O

Yeah, I’d say that’s enough to keep you busy! Start with the LED’s — learn how to light them up — flash them in patterns, back and forth — be inventive and experiment. Once the flashing of LED’s is understood, add in A/D conversion with the variable resistors (VR1/VR2) and make the patterns change with the pushbuttons.

Still a little too basic for you? How about an IR send/receive device (such as a TV remote)? What about PWM (Pulse Width Modulation) for servos/stepper motors — want to build a robot? You could add an iButton reader to it and design your own lock. Or maybe use the serial port for communications within a home automation project. The possibilities are only limited by your imagination.

OK, so that’s about it for this post — I hope that I have possibly encouraged you to join the world of embedded devices, get yourself a Junebug and start experimenting! A mind is a terrible thing to waste.

I’ll update this post as I add some code here so that you can play with the Junebug Tutor. If you want to check out the Junebug in more detail, or any of Bill’s other porducts, shoot over to www.blueroomelectronics.com.

85 Chevy P/U – frame strip down and paint

This post highlights the rebuild process of the old 305 in my 1985 Chevy Short-Box, Step-Side Restoration Project.

I’m finally getting some pics taken of my progress (which has been relatively slow as I simply have a ton on the go this summer). This weekend past I finished up the frame restoration. Basically, it involved grinding down, spot blasting, cutting out, repairing and painting of the frame. It’s actually done, but I haven’t taken pics of the painted frame yet. Here’s what I do have;

  

A bad portion of the frame needed to be repaired. Here, I’ve ground off the original rivets used to secure the leaf spring supports to the frame — and pounded them through to remove the supports. The bad section was then cut out with a small cut off wheel in an air grinder.

 

  

After welding in the new piece of steel, the welds were ground down to produce a smooth, finished surface (well, better than the rest of the frame anyway!).

 

The leaf spring supports were then reattached with grade 8 hardware. The key to this was marking the location of the support on the frame before removing it. Of course, I had to do this on the top of the frame as I was cutting out most of the side. I would imagine you’d track poorly if you were to be off much here, which would cause excessive tire wear, among a host of other problems, such as handling.

 


Last, the frame was ground down with an angle grinder and stone, then with a wire cup brush to remove as much rust as possible. (Yeah, the underside was fun.)

I’ll have to take a few more pics and get them posted — I’ll update this as soon as I do.

Out with the old, in with the new

Well, it’s that time again — time to upgrade the service vehicle. For those of you that have read some of my posts regarding my ’03 Blazer, you’ll know why I’m happy to get a new vehicle — a 2007 Dodge Nitro.

I was going to say that I was happy to get rid of my Blazer, but that just didn’t happen. You see, I put on a lot of kilometers with my job — about 60K a year. So, my Blazer, after 3 years, had just over 180K — which made it ‘undesirable’ by the dealership. They offered me $4,500 for a vehicle that I paid $30K for three years prior — I’ll keep it, thanks.

Again, for those of you that have been following my 85 Short-Box, Step-Side Restoration project — you may have noticed that I also had an ’86 that my dad drove. I sold the ’86 yesterday and my dad moved into the Blazer. Hey, I still have the ’85 to work on! (Which should be soon… damn, I wish it would warm up!)

The way I look at it is, my dad does very little driving — pretty much city only. So, the Blazer will give him a little more comfort than the PU, not too mention the safety aspects of it. Plus, in two years, the vehicle will be worth the same as it is now simply because the kilometers will be allowed to ‘catch up’. If he puts on 10K in the next two years, I’ll be surprised. The goal is to keep in under 200K.

(As a side note, I still have to post about most of the problems I’ve had with my Blazer… just to keep you from going through the same thing.)

The FizzBuzz Test

I was stunned when I read that 199 out of 200 programmers can’t program — and I’m not speaking figuratively — they can’t write a single line of code.

This fact intrigued me, so I Google for more information on it. That is when I ran into the FizzBuzz Test. Basically, the test is as follows;

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Here’s mine, in PHP;

FizzBuzz();

function FizzBuzz()
{
for ($i = 1; $i <= 100; $i++) { $out = (($i % 3 == 0) && ($i % 5 == 0)) ? "FizzBuzz" : (($i % 3 == 0) ? "Fizz" : (($i % 5 == 0) ? "Buzz" : $i)); if ($i == 1) { echo '[a href="http://kylestubbins.com/node" alt="Return to KyleStubbins.com home" title="Return to KyleStubbins.com home"]KyleStubbins.com[/a][br /][br /]'; echo '[b]Fizz[/b] is divisible by 3[br /][b]Buzz[/b] is divisible by 5[br /][b]FizzBuzz[/b] is divisible by 3 AND 5[br /][br /]'; echo "Let's Begin![br /][br /]"; } echo $out.'[br /]'; } echo '[br /][br /]All Done![br /][br /]'; echo '[a href="http://kylestubbins.com/node" alt="Return to KyleStubbins.com home" title="Return to KyleStubbins.com home"]KyleStubbins.com[/a][br /][br /]'; }

Note: I have changed all < > brackets to [ ] bbcode style simply so they wouldn’t parse in this post! Sorry, but the formatting won’t hold for the post either! This really could be cut down to a couple of lines — all of the “extra” stuff is to display the start and end, and to add a link to get you back here, but is not needed for the actual “test”.

You can see the results here. Feel free to post yours! 🙂

The power of Linux

I have been an Ubuntu Desktop user for almost two months now, so let me update you a bit.

About a week ago, I made a HUGE mistake when running the command line as root (I can just imagine some of you grinning already). No, I was not using the rm command! That has to be the first line in every Linux book you read — WARNING!!! Then an example of wiping out your system with the rm command.

The ‘mistake’ I made, was not actually done on purpose — it was kind of a ‘wrong place, wrong time’ thing — let me explain. I was in the middle of copying some files to a new, shared directory that I setup to share with my LAN. This is when I had to ‘chown’ (CHange OWNership) the copied files — I started to type the command

sudo chown -R langroup:langroup /

when I was interrupted. Can you see it? The FULL command was going to be

sudo chown -R langroup:langroup /home/lan-shared

as I only wanted to change the ownership on that directory and it’s recursive directories (hence the -R option). But I turned around, after my interruption, and hit the enter key without completing the command.

I still wasn’t aware of what I did — it took about 4 or 5 seconds before I looked at the screen and saw it. Then, I realized what I had done! I had, inadvertently, issued a command, as root (sudo) to change the ownership (chown) of directories and files, recursively (-R), to the ‘langroup’ user and group (langroup:langroup), starting from the ROOT directory (/). Obviously, this is NOT what I wanted. 🙁

I quickly escaped the command (Ctrl-c), but it was waaaaay too late. Almost every directory and file on my system was now owned by ‘langroup’ — you can only imagine the havoc that wreaked.

It took quite a long time to get sorted out — I actually gave up on trying to save the system, but I wanted my files! The short and sweet of the recovery process was to boot the LiveCD in another machine and look at the directory structure and, more importantly, the ownership of the directories/files. From there, boot the machine I was having problems with from the LiveCD and get into recovery mode (ie. the command line — or ‘shell’). There you are root and can start changing ownership to what they should be — therein lies the time. Oh, my goal was simply to get network connectivity back so I could transfer my files. Or even get my CD writer back! Something to allow me to get my files. I ended up achieving network connectivity and was able to get my files.

I will now offer you a tip that would have saved my bacon, had I known it at the time. When installing Linux (any flavor) set yourself up a separate partition for your /home directory. Why? Simply because if you set it up in that manner, you save all your files to a separate partition on your hard drive. In the event of a serious problem, such as I have outlined above, you can simply reinstall the OS without touching (ie. without formatting) the /home partition. As an added bonus, you can install a newer version of the OS (say, for example, when Ubuntu Fiesty 7.x is released) as a clean install, and not an upgrade, if you so desire. The structure would be like so (keep in mind, this is for a single boot, Linux only machine — do a Google search if you need dual boot instructions);

Example — you have an 80G drive.

/ (root) ext3 — 10G
/home ext3 — 69G
/swap linux-swap — 1G

10G is plenty for the OS, and the 1G swap can be altered to your needs (depending on the amount of memory you have, etc.), but is a good base. Assign the majority of your drive to your home directory, as this is where the majority of files will be stored. Now, if you ever have to reinstall, you can choose NOT to format the /home partition and your data will be intact upon completion of the install.

This problem actually worked out better for me, in the long run — here’s why;

I initially installed Ubuntu on a P3 machine, and not one of my better ones, simply because I was testing the OS and didn’t know if I’d like it, or stick with it. I quickly found that I did like it, used it the most, and wished I had put it on a better machine. Part two of that is that I also wanted to install Beryl (a Linux Theme Manager — all kinds of cool stuff that’ll give any Vista user a run for their money!), but it just didn’t like the older hardware (especially the ATI video card!) and wouldn’t run.

Well, seeing that I now had to reinstall Ubuntu, now was the perfect time! Instead of reinstalling Ubuntu on that machine, I threw Window$ XP back on it as I still, unfortunately, need a Windows machine (no, I haven’t tried ‘Wine‘… yet!). From there, I copied all the files over from my current XP machine and then installed Ubuntu on that machine — a P4 3.2GHz dual core machine with 2G of ram, 2 x 200G SATA drives, yadda, yadda, yadda.

I’m happy to announce that Beryl installed without a hitch — and man, IS IT SWEET! Do a search for ‘Beryl’ over at YouTube.com — there are a bunch of videos there demonstrating Ubuntu & Beryl.

The moral to this post? The ‘chown’ command can be just as dangerous as the ‘rm’ command, if you’re not careful! 😉

More 4 wheel drive problems with my ’03 Blazer (UPDATED)

Am I glad that I fixed my 4 wheel drive! I’ve needed it a few times this month. The unfortunate part of this update is the fact that I now have a very defined “clunk” in the front differential. Of course, this is just speculation at this point simply by where and when the noise occurs.