Google is committed to advancing racial equity for Black communities. See how.

Sensor Fusion Controller

This page describes how to assemble the revision 2 controller for a sensor fusion test rig. The sensor fusion test is part of the Camera Image Test Suite (Camera ITS) in the Compatibility Test Suite (CTS). The rev2 controller is designed to ease assembly and reduce costs. Additional benefits are supply isolation between electronics and servos and control of up to six servos from a single controller.

Revision 2 sensor fusion controller overview

Sensor fusion test rig

The sensor fusion test rig provides a fixed motion of the phone for reproducible testing. The phone is rotated in front of a checkerboard target to allow image capture with the phone at various positions. The test rig rotates the phone around the camera center of axis 90 degrees and back in about 2 seconds. Figure 1 shows two phones moving in a sensor fusion test rig.

Phone movement in test rig

Figure 1. Phone movement in test rig

Servo motor control

The analog servo motors in the test rig are positional servos controlled using pulse-width modulation (PWM). A typical positional control example is shown in Figure 2. The control signal has a period of 20 ms. Changing the pulse width to the minimum width moves the motor to the neutral position and changing the pulse width to the maximum width moves the motor 180 degrees clockwise.

Servo control description

Figure 2. Typical servo control description

Sensor fusion controller implementation

To control the servo motor motion via a host, the sensor fusion test rig requires a USB connection. The test rig rev2 controller uses a USB-connected Arduino UNO R3 board with a custom routing board (or shield) mounted on top. The two-layer shield is designed with an open-source online PCB design tool and is available at https://easyeda.com/portmannc/servo_controller. The top and bottom views of the custom routing shield are shown in Figures 3 and 4.

Custom routing shield top view

Figure 3. Custom routing shield (top view)

Custom routing shield bottom view

Figure 4. Custom routing shield (bottom view)

The rev2 sensor fusion controller can control up to six sensor fusion rigs from a single host. The top view shows the silkscreen outlines for mounting the six 3-pin motor headers along the center axis. There is an additional connector at the top that is unused for this project. The bottom view shows the silkscreen outlines for the 4 and 8-pin header connections required to mate with the UNO, a 5 V power jack and a 10 uF bypass capacitor.

To isolate the servo currents, power for the servos is provided through the external 5 V jack. The UNO electronics are powered separately through the USB connector, and there is no sharing of power between the two boards. Note that the existing external power jack on the UNO is unused and is covered up in the enclosure design to avoid confusion when connecting power to the controller.

Assembling a rev2 sensor fusion controller

Bill of materials (BOM)

Qty Description PN/Link
1 1.6 mm thick sensor fusion routing board https://easyeda.com/portmannc/servo_controller
1 Arduino UNO R3 https://store.arduino.cc/usa/arduino-uno-rev3
1 2.1x5.5 mm, 5 V through-hole, right-angle barrel jack 101179
1 16 V, 10%, 10 uF tantalum capacitors TAP106K016CCS
1 1x2, 200 mil (5.08 mm) pitch, through-hole Phoenix Contact header 651-1755736
6 1x3x, 100 mil (2.54 mm) pitch, through-hole male header 732-5316-ND
1 1x8x, 100 mil (2.54 mm) pitch, through-hole male header 732-5321-ND
1 1x4x, 100 mil (2.54 mm) pitch, through-hole male header 732-5317-ND
3 11 mm female-female standoffs (5 mm width, M3-0.5 threads) R30-1001102
4 6 mm male-female standoffs (5 mm width, M3-0.5 threads) R30-3000602
3 M3-0.5 6 mm pan-head machine screws 36-9191-3-ND
4 M3-0.5 8 mm flat-head machine screws XM2510008A20000
2 M3-0.5 6 mm flat-head machine screws XM2510006A20000
6 #4, 1/2 in round-head sheet metal screws 90925A110
1 5 V, 15 W UL-listed power supply, 2.1x5.5 mm plug (motors) 36-9191-3-ND

Other tools needed

  • Soldering iron, solder, solder-sucker
  • Small Phillips head screwdriver
  • Size T10 Torx screwdriver

Populating the routing board

Populate the top and bottom of the routing board with the parts fitting in their outlines. For the bottom of the board, the male headers can be aligned by placing the headers into the correct locations in the Arduino board and placing the routing board on top of the connectors. The 1x8 and 1x4 headers can then be soldered in place, guaranteeing good alignment between the Arduino and the routing board. The same can be done for the power jack, but a shim is needed for tight assembly as the power jack doesn't rest on the Arduino after assembly. After soldering the bypass capacitor, the top of the board can be populated with the six 1x3 male headers for motor control and the 1x2 Phoenix Contact header. Note that the header should be oriented so that the bottom of the snap in connector is toward the motors to give maximum room for the motor mount.

When all components are soldered in place, the system can be assembled using the standoffs and screws. There are four male-female 6 mm standoffs to provide mechanical stability between the Arduino and the bottom of the plastic enclosure. However, there are only three 11 mm female-female standoffs between the Arduino and the custom shield because one hole on the Arduino (the one near the SCL pin) is unusable due to its proximity to the female header on the Arduino. Screw the three female-female standoffs on to three male-female standoffs to secure the standoffs to the Arduino. Then attach the routing board shield to the standoffs with the three M3 screws. Figure 5 shows a conceptualized end view of the populated shield mounted on the Arduino. Figure 6 shows a photograph of the populated and mounted system.

Conceptualized end view of populated shield mounted on Arduino

Figure 5. Populated shield with headers, power jack, and spacers shown (conceptualized end view)

Populated shield top

Figure 6. Populated rev2.2 shield mounted on Arduino (top view)

Controller enclosure

The controller includes a custom enclosure. The mechanical drawing is shown in figure 7.

Mechanical drawing of enclosure

Figure 7. Mechanical drawing of enclosure

The assembled controller mounts to the enclosure through four countersunk screws through the bottom plate of the enclosure. The enclosure can be assembled through the six round-head and two flat-head assembly screws. Pertinent information, such as servo number order and 5 V external supply, are etched into the plastic top. Figure 8 shows a photograph of the controller inside the assembled enclosure.

Assembled system in enclosure

Figure 8. Assembled system in enclosure

Software control from host

Micro-code can be downloaded to the UNO to assign the PWM pins to the motor signals and define the pulse-width ranges for different angles. The micro-code for servo rotation control of the six HS-755MB motors is included in Other resources. That section also includes a link to a simple program called rotator.py, which rotates the servos.

Using the rev2 controller

Camera ITS usage:

python tools/run_all_tests.py device=device_id camera=0 rot_rig=arduino:1 scenes=sensor_fusion

With included test script:

python rotator.py --ch 1 --dir ON --debug

Other resources

Mechanical drawing downloads

Software control downloads