Skip to main content

Connecting to a HiTechnic prototype board to an Arduino

Connecting to a HiTechnic prototype board to an Arduino.


If you are thinking to yourself, “ Wouldn't it be fun to take a prototype board from Hitechnic and connect it to my Arduino? I wonder if it is possible...” Well I am here to tell you that Yes, indeed it is possible, it is not only possible it works rather nicely, of course - HiTechnic doesn’t really support this and the NXT documentation doesn’t have a section called “Cutting a cable in half to connect it your Arduino” so it took a little research to make it it happen which is why I thought I would share this information with the world.


Step one - the cable 


I took a cable from my mindstorms kit and chopped one end off, I then took some nice stiff jumper wires and soldered them onto the ends so I had something that I could plug into the Arduino.

 Step two - What goes where. 


So the big question was what pins to plug it into on the Arduino. I have an Uno which means that pins A4 and A5 are the i2c SDA and SCL lines, of course power and ground and everything else is nicely labeled and documented on the Arduino,

Not so for the prototype board. Fortunately J1 was labeled on the board itself I then referenced the HDK (hardware developer kit) for the NXT. On page six there is a schematic of an input port pointing out what’s what. It’s a little backward because pin one is J7 in the drawing and the board is labeled J1 so don’t get confused (the wire closest to J1 is 6). However, the figure on page 6 doesn't tell you which is which regarding the SDA and SCL lines - I found that on page 9 the fourth bullet point if you want to see it for yourself.

Armed with this knowledge I took the plunge and plugged it into the Arduino and wrote some code which didn’t work! But nothing melted either so I guess it was a mixed bag.

Step Three - Where oh where is my i2c device? 


As it turns out HiTechnic provides a great page with the device address and the addresses for the various ports on the board etc, the only issue was that my device wasn’t at 0x10 like the site states, it was 0x08. This caused a lot of misery until I found this handy dandy bit of code to scan the i2c bus and tell you the location of anything it finds. Imagine this moment after hours of fighting with this wondering what I had done wrong / failed to understand / etc... etc.. I would go with, clouds parting to reveal the light and sounds of angels in chorus. Now I was in business.

Step Four - A simple sketch to print the version number, manufacturer and sensor type. 

Now that I could talk to the thing I just wanted to verify beyond a shadow of a doubt that is worked The following simple sketch just prints the information about the board over and over. It’s glorious.

Comments

Popular posts from this blog

Unit testing static methods when using Membership and ProfileBase in MVC 4

So you might be thinking that you want to use the Membership class and the ProfileBase class in Microsoft’s System.Web.Security and System.Web.Providers but then you also want to write unit tests as well so you decide to go stand in traffic instead once you are overcome by the plethora of static nonsense that is the design of these two classes. OK, so it isn’t that bad but it is frustrating however there are ways around it and I wanted to try and blog about some of those techniques in the hope that others won’t have to toil with as much frustration as I did when using these classes. Backgound Basically I wanted to find a clean simple way of making use of and extending Microsofts built in forms authentication. It’s easy to use, relatively secure and can save a lot of time and code, well sort of until you want to unit test. The ProfileBase class is great for extending profiles and adding custom properties so you don’t have to introduce a whole lot of redundant code. A good example of

Styling the combox box in WPF

If you want to play with the style of the combo box in WPF the easiest thing to do is use expression blend, drag a combo box control onto you project then click, "Edit Template" -> "Edit a copy"... This will take the entire default template for the combox box and put it into your XAML file. Now go to the XAML and you can grab the entire style and do whatever you like with it... I usually put things like this into a main poject under the solution, something like "shared" is a good name for the project... One thing that is important to note though is that you have to include a reference to the PresentationFramework.Aero assembly cause you will need the Microsoft.Windows.Themes namespace.