March 15, 2014

Investigating HC-SR04 ultrasonic sensors for suitability of use with Vernier Sensor Systems

Filed under: Daily — profmason @ 6:10 am

The Vernier Labpro system consists of a 4 channel analog and two channel digital microprocessor based data acquisition system.  It uses a serial protocol to communicate with the host PC which is well documented in the Vernier Labpro technical manual. The data acquisition system is robust and suitable for classroom use, especially with either their well thought out Logger Pro software or with their LabVIEW VIs.

The Labpro system has a wide variety of sensors that are robust and again suitable for student use.  There are two sensors that consistently require replacement in student labs, the motion detector and the force sensor.

Vernier uses British Telecom connectors called BTD and BTA depending on the orientation of the plug.  I cut a cable and found the following:












Vernier uses an Auto-ID system for the sensors that is based on reading the voltage on Auto-ID pin (I assume using an ADC pin)  They publish some values in the Labpro technical manual.  Tying a 15K ohm resistor between the Auto-ID pin and ground made the cable consistently ID as a motion detector.

The motion detector is based on the Polaroid Ultrasonic ranging element coupled with the TI6500 ranging chipset.  This is a good system and provides long ranges (Classroom use suggests ranges between 20cm – 5m reliably)  The image below shows how the sensor functions.

1.  The INIT line is pulled high and the sensor generates a pulse train.  There is an internal blanking frame that limits the minimum range to ~50cm (This can be switched off with a switch on the sensor if the shorter range of ~20 cm is desired)

2.  A timer is started in the logger pro.

3.  Once the TI6500 detects the return pulses, it sets the Echo line hgih.  Once the Echo line goes high, the timer in the logger pro stops.     The distance is calculated based on the speed of sound * the return time  / 2.

The sampling speed is thus limited by the distance of the object.  If objects are closer the sensor could conceivably sample faster.  In practice the sample rate is limited to about 30 Hz as the transducer resonates and thus some damping time is appropriate.

Unfortunately the Polaroid element is large and fragile.  The most common failure mode is for students to drop something onto the sensing element or run a cart or other object into it.  As long as the membrane is not damaged, the sensor can be repaired by carefully bending the metal mesh back into position.   As we run 1000 students a semester through physics there are inevitable accidents which are beyond repair.  As the Sensor (now price reduced to $80) is expensive it would be ideal to have a less expensive option.

The HC-SR04 is an extremely inexpensive ultrasonic module made in china and based on the design of SRF-04 back in 2000.   It contains a small micro, a MAX232 to drive the Transmit Transducer at 16V, a quad LM324 for amplification of the return signal and a couple of transistors for shaping.

The HC-SR04 uses a different pulse scheme then the TI6500 as shown below:

This means that you have to time the echo pulse width instead of running a timer until the echo line goes high.  This has a number of advantages in terms of scalability to multiple sensors and allows you to use a single line per sensor by tying the Signal and Echo Lines together. Unfortunately it is significantly different from the TI6500.

Here is the schematic of the HC-SR04

The TL0974 op-amp shown was replaced with a LM324 on the part I was using.

Connecting the HC-SR04 to the Init and Echo pins gave the following:

It is difficult to see, but the HC-SR04 is timing out, and then sending a small pulse (as can be seen on the Echo line).  The width of this pulse does correspond to the distance.  However, the labpro doesn’t know what to make of this.

Next another line was connected to the output of the amplifier, so that we could see the returning pulses.  It was confirmed that start of these pulses corresponded to the return time for the pulse from the end of the init pulse.

At this point, perhaps the next step is to try a hex inverter to flip the init signal and do some pulse shaping on the return signal.

Fortunately, we have had better luck with the Force sensors, but that will be another article.

December 19, 2013

3pi with easy integrated encoders

Filed under: Daily — profmason @ 4:31 am

After some searching I couldn’t find anyone that had attached the new mico gear motor encoders to the 3pi platform. At the black friday sale I picked up a little bit of everything and spent an hour putting it together this morning. It is an intermediate soldering job to do the following. The good news is that everything fits.

1. Remove the stock 30×1 3pi motors. (Unscrew the plastic motor cover, and then desolder the two motor pins from the 0.1 inch pins.
2. Replace them with the 30×1 dual shaft motors.
3. Insert the encoder electronics module.
4. Solder at least 4 wires to the module. I used wires terminated in standard 0.1 inch pins, but you can also use 2mm cable as the pin spacing is 2mm instead of 2.54 mm. This is a bit fiddly after two cups of coffee. (Hey pololu, dump the M1 and M2 and give us a 2.54 connector for fat american hands. ( I really wanted to solder a 2.54 mm male header here. Yes I have 2mm headers from working on so many korean projects, but who else does!)

5. Hook up power and ground and check the output on a scope.

It is going to be a bit tricky as it would be nice to have one interrupt per encoder, but I will steal IO off the LCD to make this work, the other interrupt is tied to one of the motor control pins. I will probably end up using the pin change interrupts.

5. Hook up power and ground and check the output on a scope.

November 9, 2013

WIN USA Mini Urban Challenge

Filed under: Daily — profmason @ 11:13 pm

WIN USA in collaboration with Mt. San Antonio College presents:

MiniUrbanChallengeMINI URBAN CHALLENGE and Robot Showcase

December 7th from Noon to 3PM.

Robots from all over all over the East San Gabriel Valley will descend on Mt. San Antonio College for the first annual WIN USA Mini Urban Challenge. Participants will compete with their autonomous robots to drive through a model city completing missions that challenge both novice and expert roboticists.

  • Mini Urban Challenge Competition
  • Sumo Robot Competition
  • Line Race Competition.
  • Tour of the Mt. SAC exploratorium
  • Exposition of Mt. SAC robotics team VEX robots
  • Demonstration of Mt. SAC Intelligent Ground Vehicle.
  • Open Source WIN robot demonstration
  • Open Source WIN robot will be available for sale

Rules are available at

Schedule for the Event:

  • 12:00 Check In
  • 12:15 Opening Ceremony
  • 12:30 Line Race
  • 12:45 Sumo Robots
  • 1:15 Break / Lunch
  • 1:45 Robot Exposition
    • WIN Robot
    • VEX Robots
    • IGVC Robots
  • 2:15 Mini Urban Challenge
  • 2:50 Closing Ceremony

September 11, 2013

Mt. SAC Roboexpo V

Filed under: Daily — profmason @ 6:15 pm

Welcome to the Mt. SAC Roboexpo V.

Mt. San Antonio College is proud to host a State Final Qualifying VEX Robotics Competition (VRC) event for the fifth time .   This is a State Final Qualifying event and will have 5 state qualifying spots available to top finishers.

There will be two arena’s running for competitions in addition to a practice arena outside the pit area and a VEX College arena also available for practice.   Skills and Programming Challenges will run in the competition fields mid-day after the qualifying matches and before the the semi-final matches.

The event will start promptly at 9AM.  Door open at 8 AM and please arrive by 8:30 AM for registration.   The event organizers will work hard to have the event over by 5 PM.  Be sure to register for Skills and Programming Challenge when you arrive at the event so that the competitors can queue in a timely fashion. Free parking will be available in nearby lots.

The world champion Robomagellan team will be on hand to demonstrate their autonomous outdoor navigation platform and talk about their preparations for the Army / AUVSI Intelligent Ground Vehicle Challenge.  The gold medal winning humanoid robotics team will be present to talk about the challenges of humanoid robots.    The developer of RobotC compatible VEXduino will be present and giving out free VEXduino PCBs which allow your VEX sensors and motors to be connected to the Arduino platform. There will also be representatives from local aerospace to talk about opportunities in Robotics.

Participants will be asked to sign a waiver as there will be a feature article in Robot Magazine on Roboexpo V.  Please be ready to promote your school and team to be included in the article.

Map to Venue

August 12, 2013

Inexpensive Robot Kit

Filed under: Daily — profmason @ 12:25 am

I was asked for an opinion and for help sourcing an inexpensive robot kit.  I just happened to be playing with the L9110 hbridge boards so it seemed like time to revisit the topic.

First what are desires for a basic robot kit? It depends on the application.  There are a variety of competitions in the local area.  I have co-organized the Mini Urban Challenge for the last two months at RSSC.  The following competitions are pretty standard:

  • Mini Sumo
  • Line following
  • Table top navigation
  • Mini Urban Challenge

These competition require the following sensors:

  • wheel encoders
  • line sensors (prefer multiple)

Optional sensors

  • color sensor
  • distance sensor

Thus our sample robot will have the following:

  1. A lasercut chassis
  2. A pair of wheels in differential drive configuration
  3. Wheel encoders
  4. A line sensor array
  5. Motor controllers for the wheel motors
  6. Arduino UNO
  7. AA battery pack
  8. Sufficient wire to put it together

Here is the BOM with sources.

  1. 2WD smart Robot Car Chassis Kit (Contains laser cut chassis, wheels, gear motors, hardware, encoder disks and battery pack)  $11.59 
  2. Encoder module compatible with Chassis Kit $2.13  EDIT:  Unfortunately, this module doesn’t fit the laser cut chassis we ordered, so I am forced to recommend purchasing two of these modules.  $6.40 for two.  Either you need to order a 100 mm wide chassis (the above chassis is 120 mm wide) or the dx modules above.
  3. Line Sensor Array $4.84
  4. Dual Motor Driver (HG7881 / L9110 based)  $1.82
  5. Arduino Uno $9.45
  6. Male to Female 40-Pin DuPont Breadboard Jumper Wires $2.82

Total:  $32.65

Optional items for the robot:

  • TCS3200 based color sensor $5.69  (Allows color detection for the mini urban challenge)
  • metal ball caster $3.99 (Greatly improves tracking of the robot.)
  • HC-SR04 Ultrasonic/Sonar Distance Sensor Module $1.96 (Distance sensing from 0.1 m to 3m)
  • HC-SR04 mounting bracket $1.69  (A mounting bracket to be purchased with the distance sensor)
  • IR Remote Control Kit $2.88 (Allows remote control of the robot using a TV type remote)
  • Bluetooth Module for Remote programming and control $6.81  (Allows bluetooth remote control of the robot)
  • Sensor Shield $5.59 (Allows easier connection of sensors to Arduino.)
  • Upgraded Motor Driver $4.39 (This is L298N based and can handle roughly twice the current of the L9110 based motor driver)
Older Posts »

Powered by WordPress