Posted: November 7th, 2011 | Author: Vic | Filed under: Software | Tags: advanced, debug, howto, nanode, network, software | Comments Off
I want to spend a couple paragraphs writing about Networks and debugging code running on the Nanode (or Arduino Ethernet for fthat matter) that uses them. I realize this blog entry is not for everyone, and probably will get it’s share of <yawns>, but it’s super important knowledge for when everything doesn’t go your way on networks. With Arduino sketches, you are kind of stuck with
Serial.print(...) and LEDs to get insight into what’s going on, but that’s really pretty ineffective when it comes to network interactions. Honestly, for most users the network stuff better “just work” or they are going to be turned off pretty quickly. I , however, am not one to throw in the towel when the networking stuff doesn’t work, and hopefully I can shed some light onto what can be a shadowy space in the programming / debugging landscape. There’s no substitute for using the right tool for the job.
So given that printing to the console can only get you so far with network code debugging, what is a perplexed programmer to do? Well your best choice at that point is to look at what’s going on “on the wire.” In most realms, that means busting out an oscilloscope or logic analyzer, but in the networking world, we have much better / more appropriate tools available for the job. There’s an excellent, indispensible, and free(!) program called WireShark that you can download for just about any platform. WireShark allows you to capture all the traffic on any Ethernet interface (e.g. your network card) and dig into the details of the packets, which, I might add, it conveniently parses out for you for all but the most obscure protocols. You can also set up your capture with filters on pretty much anything you can imagine related to the packet contents (MAC addresses, IP addresses, whatever). And get this, you can check a box in the capture that will have your network card capture all the traffic that it sees (not just the stuff destined for it).
Here’s the rub, though. Unfortunately (or fortunately depending on your perspective) most networks today are equiped with “smart switches,” which eliminate collision domains, which means your network card only ever “sees” those packets which are legitimately destined for it (or broadcast / multicast). So while Wireshark is an awesome tool, it alone can probably not help you debug what’s going wrong with your Nanode software. To unleash the debugging power of WireShark on your Nanode, you’re going to need some “dummer” hardware, namely an Ethernet Hub. Good luck finding one at a retail store – I had to resort to the E-bay for mine, and got an 8-port hub for about $10.
A Hub is very similar to a switch in that it gives you more places to plug into your network. The big difference with a hub is that it internally connects all the ethernet wires together (well sort of) so that all the devices connected to the hub get to “see” each others packets, unfettered by the intelligent filtering of a switch. So if you plug in the ethernet cable from your computer into the hub, plug in the ethernet cable from your Nanode into the hub, connect your hub to your router, and run WireShark, both your computer and your Nanode should be able to get “on the internet.” More importantly, your computer running WireShark will be able to “snoop” on the internet traffic going to and from your Nanode! Now we’re in business. Often times you can look at what the network traffic is supposed to look like using your computer (by filtering on traffic coming to/from your computer’s MAC address for example) and all the fancy-pants network tools that come with it (especially if you’re on a linux box), then compare that to what happens when your Nanode participates in an analogous network exchange (by filtering on the Nanode’s MAC address for example).
Armed with these tools (and some practice, and some reading about protocols), you’ll be able to get to the bottom of your network problems in no time!
Posted: November 26th, 2010 | Author: admin | Filed under: Uncategorized | Tags: howto, MintyTime | 1 Comment »
A plexiglass/perspex mounting for the MintyTime is easy to do, and provides a simple and elegant mounting which I like a lot. It is even easier than using an Altoids tin, and has the added benefit of exposing all the electronics when you look around the back, which is pretty cool.
1. What you’ll need:
- A small piece of plexiglass. Most sign making businesses have an offcuts bin where you can get small pieces for a couple of bucks. You’ll need about 5″ x 3″
- A jigsaw with either a metal cutting blade, or best of all, a floor laminate blade. I used a Bosch T101 Laminate flooring blade and it worked perfectly. These are available in “T503″ 3-packs. No additional finishing was needed.
- Your MintyTime kit and drill template, as usual. Assemble the MintyTime kit all except for the LEDs and switches – stop at the same place you would if you were mounting it in an Altoids tin. Please refer to the assembly instructions at www.mintytime.com.
- A piece of scrap wood for drilling into.
Tip: Leave the paper covering on the plexiglass as long as possible. It protects the surface, which scratches easily.
2. Cut and drill to size
Decide on how much space you want around the edges of the kit. I went for about 1/2 and inch. Using your drill template you can then decide how big your plexiglass needs to be. Set your jigsaw to cut straight up and down (no forward/ circular motion). Using a fence to ensure a straight cut, saw it to size. Cut slowly.
Now stick the drill template onto the front face of the plexiglass using (or either side if they are the same, which most are). I like to use masking tape because it is sticky enough to be useful, but not so sticky it is hard to remove. Place the scrap wood underneath the plexiglass to prevent tear out. Using a 3.8″ brad point bit in a drill press, slowly drill the holes as per the template.
It you drill too fast, the plexiglass will melt onto the drill bit, which is a real pain to deal with (guess how I know :). Go slow and lift the drill out/replunge when you are halfway through each hole, to clear the hole.
While you are in your workshop area, you might as well cut a base. I used a bit of wood with a slot cut into it, but pretty much anything will do.
Remove the template, step out of the workshop or your drilling place to somewhere with less dust, and remove the paper covering the plexiglass.
3. Mount LEDs
The is basically the same as mounting the LEDs into an Altoids tin. First, insert the LED sockets. I find rolling them between my thumb and forefinger helps make it easier to insert them. They are soft, so take care not to scratch them. You can use a cloth or the sponge the IC’s were shipped in to protect them while you push them in. Then insert the LEDs as usual.
Make sure that the LEDs all face the same way. The long pin is +ve, and will have to fit into the “+” hole on the board. Also remember that you mount the LEDs from the back of the board. As usual, take your time doing this.
Mount the circuit board onto the LEDs as per assembly instructions at www.mintytime.com.
4. Now for the buttons and battery pack.
Now that the board is mounted onto the plexiglass, you need to add the buttons, battery pack and light dependent resistor (LDR). I just cut the LDR leads short and soldered it sideways, and it works fine. (see the image above).
For the buttons flatten the pins out, solder a two short pieces of wire onto them, and then hot glue them onto the back of the plexiglass. Once that is done, snip the wires down to size if they are too long, and solder them onto the PCB.
Finally, solder the battery pack on and insert the batteries.
Viola! Drop it into the base, set the time (remember it is a 24 hour clock) and you are all done.