Showing posts with label Review. Show all posts
Showing posts with label Review. Show all posts

Sunday, December 6, 2009

HiTechnic Sensor Multiplexer Review Part 2

I spent the weekend messing around with programming the SMUX in RobotC. It was pretty intimidating at first, but after I found the sample programs and the drivers found on the HiTechnic web site, it was just a matter of spending some time staring at the code.

The first thing I found was Xander Soldaat’s “HTSMUX-Tutorial-LATEST.pdf” file found linked on the HiTechnic site. Reading this file actually scared me because it gets into the internals of the SMUX. This document does little more than confuse the lightweight programmer, but if you are a heavyweight, this document is for you. I am not a programmer, so I just look for the easiest way to use the code and hardware.

Then I downloaded the RobotC Drivers and Examples found on the HiTechnic downloads page. I spent some time looking at the SMUX examples and felt a heavy relief. All of the hard core programming has been set up in drivers, and the sample programs do a great job of showing how to access and use the drivers. Xander has done a great job of making the sample programs easy to understand. All of the programs are very similar, so switching back and forth for different sensors is pretty easy once you figure out his methods.  There is also a great video showing how to set up the drivers so they can be easily accessed within your RobotC programming environment.

The only real problem that I encountered was some of the timing issues. I hooked up four sensors; an acceleration sensor, an ultrasonic sensor, a sound sensor, and a light sensor. I put them all in a loop and took readings from all of them every 50ms and had great success. The problem that I encountered was initializing a couple of the sensors. I tried to set the light sensor in both Active and Inactive modes (light on and light off). I found that I had to put a 200ms WAIT statement after changing the mode. If I didn’t do that, the light wouldn’t respond and the previous mode would be used. No big deal, but it took some work to figure it out. The sound sensor has a mode selection of dB and dBA. Knowing that the light sensor had an issue, I assumed that the sound sensor would be similar and I added the same 200ms WAIT statement.

UPDATE: I discovered that this problem is an issue that currently exists in RobotC 2.0 and not with the SMUX and drivers.  I found that I was modifying the code, but new program was not being properly downloaded, thus the Light sensor was not getting the updated program to toggle the light on the sensor.  Xander has been gracious enough to work with me to identify the problem. 

RobotC has issued the following statement on the subject:
There is one primary known issue that we are working on, involving the "Compile and Download" command. The issue seems to be caused by ROBOTC incrementally downloading the program to the NXT and a memory issue on the PC-side where it is not recognizing changes in the program. We're close to a fix and an updated release - but in the mean time, try a suggested work around:

1. Open or modify your program inside of ROBOTC.
2. Save your program by going to "File - Save" (or use ctrl-S keyboard shortcut)
3. Go to "Robot - Compile Program" (or the F7 keyboard shortcut) - This step forces ROBOTC to regenerate the code from scratch.
4. Now go to "Robot - Compile and Download" (or the F5 keyboard shortcut) to download your program to the NXT.
5. Repeat these steps whenever you make modifications to your code.
HiTechnic has not released NXT-G blocks yet, and I look forward to seeing how they work. I hope it will give me even more insight that I can carry over to RobotC.

None of the legacy sensors are supported on the SMUX.  The HiTechnic IRLink is not supported because you cannot send commands though the SMUX, but that is not necessarily a bad thing since you still have three other ports available.

In an earlier post, I mentioned that there is an indicator light on the battery box. I was wrong. There are actually two indicator lights and they are actually on the SMUX. The green indicator shows that the battery box on/off switch is on and the red light shows that the NXT is turned on and connected. The SMUX will not operate unless both lights are on. Both lights turn off when the NXT is powered down. It’s actually a pretty handy feature.

Overall, I like the HiTechnic SMUX. I would recommend it, at least if you are a RobotC user.

Saturday, December 5, 2009

HiTechnic Sensor Multiplexer Review Part 1

I just got the Sensor Multiplexer from HiTechnic the other day. I haven’t even plugged in a cord yet, but I wanted to share a few initial thoughts.



The first thing I noticed is that it is slightly bigger than I imagined. No big deal, I just imagined it to be a little smaller. It’s about 2 ¼ inches square and about 1 inch high or 7 studs square by 3 studs high. It is built to standard Lego dimensions so it will easily fit into your mounting.

HiTechnic carefully avoided infringing upon the Lego stud design my making all the protrusions and the distance between them one stud wide so a standard beam fits between them. You cannot snap the SMUX into your project so it must be captured between regular elements.

The second thing I noticed is that it has an external power source of a 9 volt battery box. There is a rather small red and black wire about six inches long connecting the battery box to the SMUX. I didn’t realize it required an external source because I was using the Touch SMUX as a reference which does not have the battery box requirement and I guess I didn’t look closely at the picture on the HiTechnic web site.

There is an indicator light on the battery box which has some functions related to the state of the SMUX and I will get into that more when I start to program it. There is a small on/off switch to turn the SMUX on during operation. You must use a small screwdriver to install the battery.

The battery box isn’t built to Lego dimensions, which makes mounting a little more cumbersome, but not overly difficult. The best way to mount is right now is probably using a couple of rubber bands and strapping it to other Lego elements. Personally, I wish that the battery box was incorporated into the SMUX. That way all the mounting could be done at the same time and I wouldn’t have to worry about breaking the small wires connecting the two during construction.

The distance between the ports on the SMUX are just wide enough for a beam to fit between them, but it is tight.