Gas station without pumps

2016 April 16

Santa Cruz Mini Maker Faire went well

The first Santa Cruz Mini Maker Faire seemed to go well.  I did not get to see much of it, since I was busy at my booth most of the day, though I did get a break for lunch while my assistant Henry manned the booth, and I made a quick tour of the exhibits during that break, to see what was there, though with no time to chat with other exhibitors.

I understand that about 1800 people bought tickets to the Mini Maker Faire, which probably means there were over 2000 people on-site, including volunteers and makers.  I hope the food vendors did OK—I ate at the Ate3One truck, since I never have before, but my opinion afterwards was that CruzNGourmet and Zameen have better food (both of those trucks are frequently on campus, and I’ve eat at each several times).

My day went pretty well, though I had one annoying problem, having to do with my pulse monitor display. When I set up the booth Friday evening, the pulse monitor was not working, and I thought that the phototransistor had somehow been broken in the rough ride in the bike trailer, so I brought the pulse monitor home, replaced the phototransistor and tested in thoroughly.  Everything worked great, so I packed it more carefully for transport in the morning.

When I got everything set up Saturday morning, I found I had no electricity, though the electricity had worked fine the night before.  After I finally tracked down a staff member with the authority to do anything about it, he suggested unplugging the other stuff plugged in and switching outlets.  I turned out that the only problem was that the outlets were so old and worn out that they no longer gripped plugs properly—taping the extension cord to the outlet box so that the weight of the cord didn’t pull out the plug fixed the power problem.

Once I had power, I tested the pulse monitor, and it failed again!  I used the oscilloscope to debug the problem, and found that the first stage transimpedance amplifier was saturating—there was too much light in the room, and even shading the pulse monitor didn’t help. By then, my assistant for the day (and my group tutor for the class on campus), Henry, had arrived and gotten the parking permit on his car, so I raced home on my bike to get resistors, capacitors, op amp chips, multimeters, hookup wire,and clip leads to try to rebuild the pulse monitor from scratch on the bread board.

When I got back to Gateway School, I tried a simple fix before rebuilding everything—I added a pair of clip leads to the board so that I could add a smaller resistor in parallel with the feedback resistor in the transimpedance amplifier, reducing the gain by a factor of about 30.  This reduced gain kept the first stage from saturating, and the pulse monitor worked fine.  Rather than rebuild the amplifier, I just left the pair of clip leads and the resistor in place all day—they caused no problem despite many people trying out the pulse monitor.

I think that I want to redesign the pulse monitor with a logarithmic first stage, so that it will be insensitive to ambient light over several decades of light.  That should be an easy fix, but I’ll have to test it to make sure it works. I don’t think I’ll have time this weekend or next to do that, but I’ll add it to my to-do list.

I’ll need to think about whether to include having a logarithmic response in the textbook—that is certainly more advanced than what I currently include (just a transimpedance amplifier), which is already pushing students a bit.  A transimpedance amplifier is a pretty common component in bioelectronics, so I really want to leave one in the course.  I’m not sure a logarithmic amplifier is important enough or simple enough to include at this level (I don’t currently cover the non-linearity of diodes).


Here is the booth display with my assistant, Henry. I was permitted to use painter's tape to attach the banner to the whiteboard.

Here is the booth display with my assistant, Henry. I was permitted to use painter’s tape to attach the banner to the whiteboard.

The magenta laptop on right (which my family refers to as the “Barbie laptop”) was a used Windows laptop that I bought for testing out PteroDAQ installation on Windows. It was set up with PteroDAQ running all day, recording a voltage from a pressure sensor and a frequency from a hysteresis oscillator (as a capacitance touch center).

Just to the left of that was a fairly bright stroboscope, using 20 of my constant-current LED boards. To its left is my laptop, displaying the current draft of my book. Behind (and above) the laptop is my desk lamp, which uses the same electronic hardware as the stroboscope, though with only 6 LED boards, not 20.

In front of the laptop is the pulse monitor, which includes a TFT display in an improvised foamcore stand. I used just a half block for the pulse sensor, relying on ambient light (sunlight and the desk lamp) for illuminating the finger.

To the left of the pulse monitor was a stack of business cards for my book and sheets of paper with my email address and URLs for this blog and the book.  I should have included the PteroDAQ URL as well, but I had forgotten to do so. I did tell a lot of people how to find PteroDAQ from the navigation bar of my blog, but putting it on the handout would have been better. Ah well, something to fix next year (if Gateway is crazy enough to do another Mini Maker Faire, which I hope they are).

I also had all my bare PC boards that I had designed and not populated, plus my two Hexmotor H-bridge boards, behind the business cards. One of the amplifier prototyping boards was displaying in the Panavise that I use for soldering.

On the far left of the table is my Kikusui oscilloscope and two function generators, set up to generate Lissajous figures.  I let kids play with the frequencies of the function generators, take their pulse with the pulse monitor, and play with the pressure sensor and the capacitive touch sensor.

My booth was not the most popular of the Faire by any means (certainly the R2 Makers Club in the next booth was more popular), but I was kept busy all day and I talked with a lot of people who seemed genuinely interested in what I was doing, both with the UCSC course and as a hobbyist.

2013 June 9

Three-phase motor

Filed under: Hexmotor H-bridge board,Robotics — gasstationwithoutpumps @ 17:10
Tags: , , ,
Picture of 3-phase motor from capstain side (similar to the view in the catalog, but a better, higher-resolution image).

Picture of 3-phase motor from capstan side (similar to the view in the catalog, but a better, higher-resolution image).

About a year ago, I bought some cheap motors from American Science and Surplus, including one that they listed as

40788P1 36-STEP MOTOR
$2.75 EACH

The 36 Steps
This new 12VDC 1A stepper motor with 36 steps per revolution was for a printer, maybe. Or a scanner, maybe. Whichever, it’s mounted on a 2-1/2″ x 2″ plate with a 3/4″ long shaft with a 5/8″ dia rubber wheel out one side and a 15-tooth, 2″ dia plastic sprocket on the side with the leads. The (5) blue leads opposite the white go to 2.8 Ohm coils. Sorry, no wiring diagram available. Samsung P/N 02914900.

My son and I were looking through my drawer of parts when we came across it, and he was interested enough to try to figure out the wiring.  We were not able to find any information about this part on-line.  If someone has more info than what is in this blog post, please let us know!

Connections for three-phase motor: HA, G, 5, A, B, C.

Connections for three-phase motor: HA, G, 5, A, B, C.

The wiring on the back was a bit mysterious, as there are 6 wires, but they are not labeled in an obvious way for a stepper motor (HA, G, 5, A, B, C). With an ohmmeter, my son determined that the A, B, and C connections were all about 3Ω from each other, and had no DC connections to the other three wires, which also seemed to have no low-resistance connections among themselves.

The three phasors for three-phase inputs to a motor (or outputs when the motor is run in reverse as a generator).  Note that the three phasors are 120˚ out of phase, but the differences B-A and C-A are only 60˚ out of phase with each other.

The three phasors for three-phase inputs to a motor (or outputs when the motor is run in reverse as a generator). Note that the three phasors are 120˚ out of phase, but the differences B-A and C-A are only 60˚ out of phase with each other.

I conjectured that the motor was not a standard stepper motor, but a 3-phase brushless DC motor.

We tested this conjecture by hooking up an oscilloscope to measure the voltages B-A and C-A as we spun the motor shaft by hand.  Sure enough, we got sinusoidal voltages out, with different phases. We were a bit confused, though, as the phases looked to be about 60˚ apart, when we were thinking that they should be 120˚ apart.

The figure to the left explains our confusion.

I further conjectured that the other three connections were supposed to be for feedback from a Hall-effect sensor, so that the motor could be controlled in a feedback loop. I hooked up “G” and “5” to Gnd and a 5-volt supply, and put an oscilloscope probe monitoring the HA-G pair. Sure enough there was a small periodic spike as we spun the shaft, synchronized with the sine waves on the ABC connections. It struck me as very strange that the spike went negative from a zero baseline, though, so I tried adding a 22kΩ pullup resistor, which turned the small, narrow spike into a clean square wave alternating between 0v and 5v, with a period the same as the sine waves and a 50% duty cycle.  For connection to an Arduino, no resistor is needed, as an input pin can be configured to use an internal 20kΩ pullup.

With the Hall-effect sensor working, we could determine how many periods of the sinusoid there were in one revolution of the shaft.  We marked the capstan so that we could judge a full revolution, and counted 6 cycles per revolution.  We also counted 36 “click stops” per revolution (6 per cycle), which would correspond to the permanent magnet rotor lining up with pole pieces for A, B, C, A’, B’, C’.

I next wanted to determine how fast I could spin the motor and what phase relationship the Hall-effect sensor should have to the sinusoids input at A, B, and C.

I decided to use my Hexmotor H-bridge board to control the motor.  The board is not designed for 3-phase control, so I can’t do independent pulse-width modulation (PWM) on arbitrary half-H-bridges. So I used 3 separate H-bridge chips, each of them with only one half-bridge under PWM control.  Initially I tried using a sinusoid approximation with different PWM values every 15˚, then every 30˚, then every 60˚.  I finally ended up with a simple square wave for each of A, B, and C, which I could have arranged to do with just two of the H-bridge chips.

I wrote a program first to see where the Hall-effect falling edge occurred when the motor was given a constant frequency input for a fairly slow spin.  This should be the phase for the rotor almost in phase with the magnetic field, and the maximum torque should occur when the rotor lags the field by about 90˚. When the rotation is slow, I get that the falling edge of the Hall-effect pulse comes about 22% of a cycle (80˚) after the rising edge of the A pulse, so maximum torque should occur when it lags by 170˚ (47% of a cycle).

I then wrote a simple feedback loop that looked at the difference between when the falling edge occurred in the cycle and when it would occur for maximum torque, and adjusted the period (gradually) unto the falling edge was close to the desired point.  Under no load, with a 6.4v power supply to the H-bridges, I could spin the motor up to about 3.8msec per cycle, 22.8msec/rotation, or 2600 rpm.  With a 14.5v  supply to the H-bridges, the feedback loop had some problems with hunting (it tended to stall, at which point it backed off to a much lower speed and re-accelerated).  I observed times of about 2.6 msec/cycle (3850 rpm) just before stalling.  With either power supply, the motor got quite warm, so I don’t believe that it is really designed to operate continuously at those speeds.

I also learned not to put even moderate currents through the flexible jumper wires that I have—I melted the insulation on a couple of them.  Replacing them with 22-gauge solid hookup wire eliminated the problem.

I suppose that the next step in characterizing the motor would be to measure the torque at different speeds and rotor lag angles.  I haven’t figured out an easy way to do that though, as it involves mechanical design. I should also see how slow the motor can be stepped, to see if it could be used as a stepper motor.

The next step in programming would be to make a more usable interface, so that users could specify combinations of speed, torque, time, or number of steps to move. Because I switched to square wave control, I could probably rewrite the code to use only two of the H-bridge chips, or maybe even 2 3-phase motors on with only 3 H-bridge chips, since I don’t need to worry about which pins have PWM control and which don’t.

I think I’ve played with the motor enough today, though so I’ll leave these tasks for a time when I actually have a use for the 3-phase motor.

2011 December 22

Underwater ROV again this year

Last year I blogged about MATE ‘s Monterey Bay Regional underwater ROV competition in Underwater ROV contest.  I coached a robotics club at my son’s high school, and they built a small vehicle which they barely got into the water the day before the contest, because we started so late.

Although my son is being home-schooled this year, we have kept the team going, losing one member and picking up another (so we still have only 3).  The robotics club is no longer affiliated with a school, but that makes no difference, as all the school provided us was an inconvenient time to meet (lunch on Tuesdays) and 15 minutes in the pool once.  We meet for 3 hours on Sundays at my house, which gives them enough time to get something done.

I’m still paying the expenses out of my own pocket, and we now have the construction of the vehicle taking up about a third of our living room (the benchtop drill press is the first thing you see on entering the house, unless it is on the floor to make room on the robotics table for the scroll saw).

The students have made considerable progress since last year, having replaced the high-resistance tether and switch box with a low-resistance power wire and a dry box that will house an Arduino microprocessor with H-bridge chips.  They’ve made the tether with a waterproof disconnect and have tested everything for water tightness (though only at bathtub depth, not 10 feet deep).  I think that they’ll have the basic vehicle and electronics finished by the end of January, leaving some time for designing and building mission-specific tools, programming the Arduino and the laptop GUI, and learning to pilot the vehicle.  Now we just have to find a pool to practice in.

The club members have gotten much more independent this year, so my coaching involves my making some suggestions about what they should work on at the beginning of the meeting, checking to see how they are doing about once an hour, and having a discussion with them about what they’ll need to design or build next over snacks near the end of the meeting.  I also try to get them to give me specific parts to buy, but I usually end up having to find and select parts for them.  If the group were bigger (and my wallet more able to tolerate mistakes), I could have the students doing more of the purchasing.

The challenges for this year have been published, and they are in the usual verbose style.  I may have a hard time getting all the students to read the specs carefully, since the specs go on and on with irrelevant “color” hiding the nuggets of critical information.  I’m not looking forward to making the items needed for practicing the missions this year, since they are described in the same wordy way as last year (which I found difficult to follow in several places), and they haven’t even released photos or drawings of what the objects are supposed to look like.  Trying to re-create the objects from the turgid assembly directions without pictures is going to be a nightmare.

The contest does not have any tasks this year that need a depth gauge (but I bought a pressure sensor, so the students will measure depth!), but they will need to determine compass headings, so we’re trying to decide whether to get a cheap compass and put it in the camera view, or add an electronic compass module to the electronics in the dry box.  An electronic compass is definitely cooler, but we may be running out of pins on the Arduino.

2011 October 25

HexMotor 2.3 and pressure-sensor boards

Top view of my second PC board. 3 copies of HexMotor 2.3 and 2 copies each of 3 different breakout boards for a pressure sensor.

I got the boards back from about a week ago.

The HexMotor rev2.3 boards have several new features: LEDs for +5v and +6.25v, a reset button, 16-bit shift register instead of 8-bit, servo outputs connected to pins 13, 7, 2, 9, 10 (rather than to the pins used for PWM).  The new board should be able to do either 6 PWM motors or 4 PWM motors, 5 servos, and 2 non-modulated reversible motors.  I was going to have the robotics club solder the board today, but they did not have time.

[Note: as of 1March 2012, I have put the HexMotor Eagle design files on the web.]

I made some breakout boards for the MPXHZ6250A pressure sensors from Freescale Semiconductor,  which gave me my first taste of SMD soldering.  At least the design uses gull-wing pins, which can be hand soldered.  The breakout board that I think that the robotics club will end up using puts a pressure sensor on one side and headers for a piggyback ADXL335 breakout board on the back.  that way there only need to be one set of wires for connecting the analog inputs and power to the sensors.

That is the board I soldered a sensor to.

Top view of the breakout board with the sensor and headers soldered in place.

The pressure sensors are tiny! I found it fairly difficult to solder the  sensor to the boards, even holding it with clamping tweezers. I did eventually get everything to stick with no shorts between the 3 signal wires, but I did have some trouble with the unused copper pads delaminating from the board.  For future reference: all pads should have wires going to them (even the unused pads) to have enough surface area for good adherence and so that some of the pad is tucked under the solder mask.

Here are the solder connections on the side where none of the pins are used.

Here are the solder connections for the power and signal pins (and an SMD capacitor).

Despite the rather sloppy soldering, the pressure sensor does work.  It turns out that the port size is just the right size for Lego pneumatics components, so testing was pretty easy.

Sensor attached to Lego pump and gauge for testing.

Here are the results of calibration tests with the (probably not very accurate) Lego gauge, done by my son and me.

Pressure (psi) Arduino analogRead
0 367
5 518
6 542
7 576
8 599
9 632
10 657
11 683
12 710
13 734
14 775
15 801
16 832
17 861
18 887
19 915
20 941
21 967
22 1000

The range is about right, since 22 psi plus one atmosphere is about 250kPa, which is supposed to be the high end of the sensor’s range. Also, 600″ (50′) of water is 21.67 psi, so the range from 367 to 1000 corresponds to about 50′, so the sensor should give the robotics team a resolution of about 1″ for measuring depth, as expected from the spec sheet.

The data are well fit by \mbox{Arduino reading}= 28.57 \mbox{psi} + 371. The club members will have to recalibrate the pressure sensor in water, to get calibration as depth in cm. They’ll probably have to re-zero the sensor every day they use it, to compensate for atmospheric pressure, since it is an absolute pressure gauge.

2011 September 27 sticklers for the $50 multiple-image surcharge put a hold on my second order from them, asking for an extra $50 (bringing the cost up to $100.30) for the new board, because there were multiple images.

I asked them on the phone what the rule was now for defining multiple images.  Although they did not give an exact algorithm, basically they are looking for separate pieces unconnected by copper traces.  I suspect that they either do a quick look at the board manually or have some very crude program to detect probable repeats.

They are not looking just for exact repeats (which is the rule that Gabriel Elkaim told me they used), but anything that looks like multiple boards. Now I have to decide whether to pay the $50 surcharge, find another vendor, or redesign the board.

For the tiny breakout boards I may be better off with a order, at $2.50/sq in + $10 setup. I had 3 (slightly different) copies of the hexmotor 2.3 board, plus 2 each of 3 different breakout board designs for the pressure sensor.

The areas and prices for the boards (not including shipping) are

board dimensions area price
pressure 1.3 0.7″ × 1.45″ 1.015 sq in $15.08 for 2
pressure 1.4 1.5″ × 1.0″ 1.5 sq in $17.50 for 2
pressure 1.5 0.475″ × 0.8″ 0.38 sq in $15.00 for 2
hexmotor 2.3 3.95″ × 3.15″ 12.44 sq in $41.11 for 1, $103.32 for 3
combined 7.537″ × 6.737″ 50.78 sq in $136.94 for 1

So if I keep the original order, I’m better off with pricing, but if I get only 1 motor controller board, I could reduce the price to about $75+shipping (with a new combined board, to avoid the repeated $10 setup).  If I just want the breakout boards, I could do all of them without the hexmotor board as 2 copies of  a combined 1″ × 3.825″ board  for $29.13+shipping.

UPDATE: I decided I want the new features of the hexmotor 2.3 board enough to spend the extra $60 rather than just using the old hexmotor 1.3 board.  When I want tiny boards, though, I’ll try, which will be cheaper for boards smaller than about 13 square inches (depending on shipping and how many are ordered).

Next Page »

%d bloggers like this: