Silicon ChipUltrasonic Garage Parking Assistant - March 2016 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Future electronic developments in cars
  4. Feature: A Look At Quantum Computers by Dr David Maddison
  5. Project: Ultrasonic Garage Parking Assistant by Geoff Graham
  6. Project: 1-Wire Digital Temperature Sensor For The Raspberry Pi by Greg Swain & Nicholas Vinen
  7. Project: Delta Throttle Timer For Cars by John Clarke
  8. Product Showcase
  9. Serviceman's Log: Sorting my quake-damaged workshop by Dave Thompson
  10. Project: Solar MPPT Charger & Lighting Controller, Pt.2 by John Clarke
  11. Project: Battery-Pack Cell Balancer For Optimum Charging by Nicholas Vinen
  12. Feature: Save Money By Replacing Batteries In Emergency Lights by Ross Tester
  13. Vintage Radio: HMV 1939 model 209 5-valve radio by Associate Professor Graham Parslow
  14. Subscriptions
  15. PartShop
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Loudspeaker Protector / High-Visibility 6-Digit LED GPS Clock / QuickBrake

This is only a preview of the March 2016 issue of Silicon Chip.

You can view 36 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Ultrasonic Garage Parking Assistant":
  • Micromite LCD BackPack PCB [2.8-inch version) [07102122] (AUD $5.00)
  • PIC32MX170F256B-50I/SP programmed for the Micromite-based Ultrasonic Garage Parking Assistant [ParkingAssistFull.hex] (Programmed Microcontroller, AUD $15.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • CP2102-based USB/TTL serial converter with 5-pin header and 30cm jumper cable (Component, AUD $5.00)
  • Micromite Parking Assistant sensor & lid (Component, AUD $7.50)
  • Matte/Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Clear UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $5.00)
  • Gloss Black UB3 Lid for 2.8-inch Micromite LCD BackPack (PCB, AUD $4.00)
  • Firmware (HEX) file and BASIC source code for the Micromite-based Ultrasonic Garage Parking Assistant (Software, Free)
  • Micromite LCD BackPack PCB patterns (PDF download) [07102121/2] (Free)
  • Micromite LCD BackPack/Ultrasonic sensor lid cutting diagrams (download) (Panel Artwork, Free)
Items relevant to "1-Wire Digital Temperature Sensor For The Raspberry Pi":
  • Script for Raspberry Pi 1-Wire Temperature Sensor (Software, Free)
Articles in this series:
  • Raspberry Pi Temperature/Humidity/Pressure Monitor Pt.1 (January 2016)
  • Raspberry Pi Temperature/Humidity/Pressure Monitor Pt.1 (January 2016)
  • Raspberry Pi Temperature/Humidity/Pressure Monitor, Pt.2 (February 2016)
  • Raspberry Pi Temperature/Humidity/Pressure Monitor, Pt.2 (February 2016)
  • 1-Wire Digital Temperature Sensor For The Raspberry Pi (March 2016)
  • 1-Wire Digital Temperature Sensor For The Raspberry Pi (March 2016)
Items relevant to "Delta Throttle Timer For Cars":
  • QuickBrake/Delta Throttle Timer PCB [05102161] (AUD $12.50)
  • QuickBrake/Delta Throttle Timer PCB pattern (PDF download) [05102161] (Free)
Articles in this series:
  • Reduce Rear-End Collision Risk With The QuickBrake (January 2016)
  • Reduce Rear-End Collision Risk With The QuickBrake (January 2016)
  • Delta Throttle Timer For Cars (March 2016)
  • Delta Throttle Timer For Cars (March 2016)
Items relevant to "Solar MPPT Charger & Lighting Controller, Pt.2":
  • Solar MPPT Charger & Lighting Controller PCB [16101161] (AUD $15.00)
  • PIC16F88-E/P programmed for the Solar MPPT Charger & Lighting Controller [1610116A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (ASM and HEX) files for the Solar MPPT Charger & Lighting Controller [1610116A.HEX] (Software, Free)
  • Solar MPPT Charger & Lighting Controller PCB pattern (PDF download) [16101161] (Free)
Articles in this series:
  • Solar MPPT Charger & Lighting Controller, Pt.1 (February 2016)
  • Solar MPPT Charger & Lighting Controller, Pt.1 (February 2016)
  • Solar MPPT Charger & Lighting Controller, Pt.2 (March 2016)
  • Solar MPPT Charger & Lighting Controller, Pt.2 (March 2016)
Items relevant to "Battery-Pack Cell Balancer For Optimum Charging":
  • Battery Pack Cell Balancer PCB [11111151] (AUD $6.00)
  • PIC16LF1709-I/SO programmed for the Battery Pack Cell Balancer [1111115A.HEX] (Programmed Microcontroller, AUD $10.00)
  • SMD Parts for the Battery Pack Cell Balancer (Component, AUD $50.00)
  • Firmware (HEX) file and C source code for the Battery Pack Cell Balancer [1111115A.HEX] (Software, Free)
  • Battery Pack Cell Balancer PCB pattern (PDF download) [11111151] (Free)

Purchase a printed copy of this issue for $10.00.

By Geoff Graham Ultrasonic Garage Parking Assistant This Garage Parking Assistant will display the distance from the back wall of your garage or carport to your car’s bumper bar, in large digits and with a colour coded background: green for go, yellow for slow down and red for stop. It makes positioning the car a breeze as you will always know just how many centimetres you are from the wall or an ideal stopping point. T HIS PROJECT is based on the Micromite LCD BackPack described in last month’s SILICON CHIP. The BackPack is a low-cost, touch-sensitive LCD panel coupled with an even lower cost microcontroller programmed in BA- SIC. Turning this into our Digital Garage Parking Assistant only requires the addition of an ultrasonic distance sensor and a suitable BASIC program. As you drive the car into the garage the display will light up, with the dis- TRIGGER ULTRASONIC DISTANCE SENSOR MICROMITE MK2 TOUCH-SCREEN LCD PANEL ECHO Fig 1: this block diagram shows the main components in the Garage Parking Assistant. The Micromite is in control: using the trigger line, it signals the ultrasonic distance sensor to transmit an ultrasonic sound pulse then measures the round trip time on the echo line. The result is converted to centimetres and displayed on the touch-screen LCD panel. 26  Silicon Chip tance in centimetres displayed on a green background. As you come closer, the background changes to yellow and then finally to red. During this time, the display will tell you the exact distance to the wall or an ideal stopping point in large 25mm-high digits. Finally, after the vehicle has been stationary for a little while, the display blanks, ready for the next time you park the car. By making some small changes to the software program, you could use the same design for other applications where you need to know the distance to an object. For example, with a simple modification, the unit could display the water level in a rainwater tank. Based on the dimensions of the tank, it could also calculate and display the content in litres, with the background colours serving as a warning when the siliconchip.com.au REG1 MCP1700-3302E +5V CON1 POWER AND CONSOLE CHASSIS-MOUNT DC SOCKET (WIRED TO USB PLUG) RED GND 10 µF +3.3V OUT IN 10 µF 100nF 100nF 5V ILI9341 BASED LCD DISPLAY Tx 13 Rx BLACK GND CON2 MICROMITE I/O DATA OUT 11 DATA IN 12 RESET 1 3 3 4 4 5 5 9 9 10 10 14 14 16 16 17 17 18 18 21 21 22 22 24 24 GND 25 25 ECHO 26 26 TRIG +3.3V 5V +5V 4-PIN MICROPHONE PLUG & SOCKET GND HC-SR04 ULTRASONIC DISTANCE SENSOR 28 15 T_IRQ T_DO T_DIN 7 T_CS T_CLK SDO (MISO) MICROMITE MK2 LED IC1 PIC32MX170F –256B SCK SDI (MOSI) 2 D/C 23 RESET 6 CS VR1 14 25 20 8 19 27 3 PINS ON IC1 47 µF TANT BACK LIGHT +5V GND VCC CON3 ICSP 1 +3.3V 4 1 – MCLR 2 –Vcc 5 3 – GND RESET 5 – PGC 4 – PGD S1 6 – NC 10k CON4 +3.3V +5V MC P1700 SC  20 1 6 GARAGE PARKING ASSISTANT IN OUT GND Fig.2: the circuit is based on a Micromite LCD Backpack, a touch-screen LCD and an ultrasonic distance sensor. IC1 does most of the work, while REG1 is a 3.3V voltage regulator. The ultrasonic distance sensor is triggered by pin 21 of the Micromite and the subsequent echo signal is then fed to pin 22. A 5V USB charger powers the circuit. water has dropped to a low level. The program running on the Digital Garage Parking Assistant is written in BASIC. This is an easy-to-learn programming language and the program is stored in plain text. And because the Micromite has its own program editor, you can connect it to a laptop and easily change the program to suit your preferences, even when it is attached to the garage wall. You might, for example, prefer the distance to be displayed in old-fashioned inches. That would require the modification of just one line in the program and could be done in minutes. How it works Fig.1 shows the block diagram of the Garage Parking Assistant, while Fig.2 shows the full circuit (including siliconchip.com.au the LCD BackPack). The key components are an ultrasonic distance sensor, Micromite microcontroller IC1 and the LCD panel. The Micromite is completely in control; it uses the ul- trasonic transducer to measure the distance and then displays the result on the LCD panel. The distance sensor emits an ultrasonic pulse and then listens for the reThe ultrasonic sensor unit is mounted on the garage wall at bumper height, while the display unit is mounted above it at eyelevel, where it can be easily seen, and shows the distance to the vehicle in centimetres. March 2016  27 The background colours on the LCD provide a simple visual warning to the driver – green to continue, yellow to slow down and red to stop. In addition, the LCD shows the distance readout in centimetres. You can change the thresholds used for the three colours via the touch-screen and the various options menus. turn echo, under the control of the Micromite. The microcontroller starts the measurement cycle by triggering the ultrasonic signal with a short positive pulse on the trigger line of the sensor. The sensor then raises the echo line to a logic high level to acknowledge that it has sent the ultrasonic pulse and then drops it low again when the echo is received. The time that the echo pin is held high by the sensor represents the round trip time for the ultrasonic pulse to leave the sensor, reach the distant object and bounce back to the sensor. The microcontroller must accurately measure this time and then calculate the distance to the target. In a normal microcontroller, this operation can be complex but on the Micromite it’s easy. The BASIC program just needs to use the DISTANCE() func- tion which will automatically generate the trigger pulse and calculate the distance to the target. The result is returned as a floating point number representing the distance in centimetres to one decimal place. For example, if you had an ultrasonic transducer connected to pins 21 (trigger) and 22 (echo), the following command would display the distance (in centimetres) to the target: PRINT DISTANCE(21, 22) The output from running the above command would be a number. For example, 26.1 would mean that the distance is 26.1 centimetres. The sensor will work with a target that ranges from 30mm to 3m. The precision will vary depending on several factors, such as the reflectivity of the object and the air temperature, but is generally accurate to within 10mm. This range and accuracy is more than adequate for our Garage Parking Assistant. The ultrasonic sensor goes by the part number HC-SR04 and can be found on eBay or purchased from the SILICON CHIP Online Shop. Compatible sensors are the SRF05, SRF06, Parallax PING and the DYP-ME007 (which is waterproof and therefore good for locations that are exposed to the weather). All of these work exactly the same as the HC-SR04. The Micromite The ultrasonic distance sensor used in the Garage Parking Assistant. The righthand transducer is used to transmit the sound pulse and the lefthand transducer receives the reflected signal. The sensor will work with targets ranging from 30mm to 3m and is generally accurate to within a centimetre. 28  Silicon Chip The Micromite has been described many times before in SILICON CHIP and has evolved into a powerful but inexpensive controller. The IC used here is a 28-pin dual-in-line (DIL) package which can be plugged into an IC socket and is programmed using a version of BASIC called MMBasic. BASIC stands for “Beginner’s Allpurpose Symbolic Instruction Code”. Originally designed as an interactive teaching language by Dartmouth College in the USA in 1963, it subsequently became widely used on early personal computers. Because of its simplicity, BASIC is often used for teaching the fundamental concepts of programming. The program for the Garage Parking Assistant is written in BASIC and because of this, it can be easily modified to suit your preferences. For example, if you do not like the colours you can change them to suit yourself. The Micromite is coupled with a lowcost touch-screen LCD panel which can display 320 by 240 pixels in any one of 65,535 colours. We chose the larger 2.8-inch version for our prototype because the displayed digits are easier to see from the driver’s seat; they are just over 25.4mm (1-inch) high. If you already have the 2.4-inch LCD, this could be used instead. Its mounting arrangement (on the lid of the case) will be slightly different, however. The Garage Parking Assistant uses the touch input to set its various options. All you need do is tap the screen and the main options menu appears. Touch support is another area where the BASIC language makes programming easy. The TOUCH() function will return the X and Y coordinates of the touched location in pixels. Using this and a selection of drawing commands, it is possible to create touch sensitive buttons and other screen objects that make sense to the casual user. Options The photo at top-right on the facing page shows the main options menu that appears when the screen is touched. In particular, it shows the timeout, offset and thresholds for the background colours. The timeout is simply the length of time after the car has stopped moving before the display is blanked. By contrast, the offset is the distance from the sensor at which the displayed dissiliconchip.com.au tance will be shown as zero. It is useful if the sensor is mounted on a wall but the car must stop before the wall is reached, perhaps because of some other obstruction. For example, if the offset is set at 10cm, the display will read zero when the distance between the car’s bumper bar and the sensor has been reduced to 10cm. Either of these two settings can be changed by touching the CHANGE button. In this case, a virtual on-screen keypad will be displayed which allows the required number to be keyed in. An example of this is shown in the photo below left. The keypad includes the ability to delete the previously entered digit (the DEL key) or cancel the entry and return to the menu (the CAN key). Pressing the ENT key will store the keyed-in number and return to the previous menu. The third entry on the main options screen shows the thresholds for the colour changes. Pressing the change button for this entry will open up a new menu as shown in the photo below right. By default the threshold for green is 200cm, for yellow it is 50cm and for red it is 10cm. Initially, as the vehicle approaches, the LCD will be blank but when the vehicle’s distance reaches the green threshold, the display will light and show the distance with a green background. Similarly, when the yellow threshold is reached, the background will change to yellow and so on. These colour changes provide a simple visual warning for the driver – yellow means slow down and red means stop immediately. You can easily change these thresholds by touch- Touching the screen on the Garage Parking Assistant displays the options settings. This photo shows the main menu, which displays the current settings for the timeout, the offset and the thresholds. Touching the CHANGE button for a particular parameter brings up a virtual keypad (see photo below) so that the setting can be changed. ing the CHANGE button and keying in the new number. The FINISHED button will save the options and return to the previous screen. All options are saved in nonvolatile memory, so they will be retained even if the power is removed. Building the LCD Backpack The first step in the construction is to build the Micromite LCD BackPack and test it to make sure that it’s working correctly. This was described in last month’s issue of SILICON CHIP so we won’t go into too much detail here. Besides, with the silk screening on the PCB, it’s obvious where the parts go and it should take less than half an hour to build. This is a typical virtual keypad which allows the user to enter a new number. It includes the ability to delete the previously entered digit (the DEL key) or cancel the entry and return to the menu (the CAN key). Pressing ENT will store the number and return to the previous menu. siliconchip.com.au Loading the firmware and the BASIC program is essentially a 3-step process. First, the blank PIC32 microcontroller must be programmed with the Micromite firmware which includes the BASIC interpreter (MMBasic). That done, the interpreter needs to be configured to suit the LCD panel. And finally, the BASIC program that drives the ultrasonic sensor and the display needs to be loaded. You have a few choices when it comes to this process: Option 1: the first option is to download the file “ParkingAssistFull.hex” from the SILICON CHIP website and program the PIC32 yourself. This file has the Micromite firmware, the settings for the LCD panel and the BASIC program all The thresholds for bringing up different background colours can be changed using this menu. The Finished button saves the options and return to the previous screen. All options are saved in non-volatile memory so they will be retained even if the power is removed. March 2016  29 STARTUP LCD TOUCHED? YES GET THE OPTIONS FINISHED NO BLANK DISPLAY GET THE DISTANCE FORWARD MOVEMENT? NO YES Program operation NO YES > GREEN THRESHOLD? TIMEOUT OCCURED? YES NO > YELLOW THRESHOLD? YES BCOLOUR = GREEN NO > RED THRESHOLD? YES BCOLOUR = YELLOW NO BCOLOUR = RED DISPLAY THE DISTANCE combined into one “package”. It must be programmed into the PIC32 microcontroller using a programmer such as the PICkit 3. Using this firmware is quite convenient because this single operation combines all three steps and sets up the chip so that it’s ready to do the job. Option 2: the second (and easiest) option is to purchase the PIC32 microcontroller pre-programmed with the combined firmware file from the SILICON CHIP Online Shop. Then, all you need to do is plug the chip into its socket and you are ready to go. Option 3: the third option is to go through all three steps individually. Step 1 is to download the file “Micro­ mite_V5.1.hex” from the SILICON CHIP website and program it into the PIC32 microcontroller using a PICkit 3. Step 2 is to connect a USB-to-serial converter to the Micromite’s console and configure the chip to work with the 30  Silicon Chip cover that the touch calibration is inaccurate, this can be corrected by connecting a USB-to-serial converter to the console, halting the program with CTRL-C and re-running the calibration. The calibration procedure was also described in detail last month. Note that if you already have a working Micromite LCD BackPack, then it will only be necessary to load Parking­ Assist.bas into the PIC32 micro. Alternatively, you can choose to reprogram the chip with the combined software (ie, ParkingAssistFull.hex). Fig.3: the software flowchart diagram. The BASIC program runs in a continuous loop. After checking for a touch on the screen the program then measures the distance to the car. Following this, a series of decisions are made to determine if the display should be blanked or to select the background colour. LCD and touch. And finally, step 3 involves loading the BASIC program “ParkingAssist.bas” (again available from the SILICON CHIP website). This can be loaded using either the XMODEM protocol or using the AUTOSAVE command. The above process was described in detail in last month’s article on the Micromite LCD Backpack and isn’t hard to do. When you have run through all three steps, the result will be exactly the same as if you had loaded the combined firmware containing the interpreter, the settings and the BASIC program (or if you purchased a preprogrammed chip). The only issue that you need to be aware of is that the touch calibration in the combined firmware was done with a reasonably standard LCD panel but yours might require re-calibration if it is significantly different from the “standard” that we used. If you dis- If you wish to modify the BASIC program, you need to have some idea of how it works. Fig.3 provides a highlevel flow diagram of its operation. As shown, the program runs in a continuous loop. First, it checks if the LCD is being touched and if it is, branches to a subroutine which will display the menus and the options. The program then retrieves the distance from the ultrasonic sensor which is averaged over five successive readings to reduce noise. It then checks for forward movement and if there is none it checks for a timeout. This is the time that the display remains on after the vehicle has stopped moving. If the vehicle is stationary, a counter will increment every second and the program will blank the display when the counter reaches the timeout setting. The program next checks the vehicle’s distance and compares it to the green threshold. If it is greater than this threshold, it blanks the display and returns to the start of the loop for another “go around”. If the distance is less than the green threshold, the program checks the other thresholds to determine the colour to be used, ie, green, yellow or red. Finally, the program displays the distance in centimetres with the specified coloured background. It then loops around to get another distance reading and repeat the process. If you are going to modify the program there is one feature that you need to be aware of. In the main program loop, the watchdog timer is set to one second. This timer is used to automatically restart the program if an error occurs. In operation, the timer must be constantly reset to one second to prevent a restart under normal operation. This means that you must make sure that the siliconchip.com.au program can execute the loop in less than one second to avoid an automatic restart of the Micromite. The watchdog timer is also used when the program detects a touch on the screen and branches to the menus where the options are set. In this case, the timeout is set to 10 minutes every time a button is touched. This was included in the program so that the Micromite will automatically restart and return to normal operation after 10 minutes of inactivity within any menu – handy if you have been called away while fiddling with the settings and forget to return. M3 x 10mm MACHINE SCREW CLEAR ACRYLIC LID WITH CUT-OUT FOR LCD (REPLACES ORIGINAL UB3 BOX LID) TOUCH-SCREEN LCD 2 x M3 WASHERS M3 x 6mm MACHINE SCREW M3 x 12mm TAPPED SPACER 2.8" LCD PCB MICROMITE BACKPACK PCB Fig.4: here’s how to attach the LCD & Micromite BackPack PCB to the clear acrylic lid. The LCD goes through a cutout in the lid and sits flush with its top surface. Building it The first job in the assembly is to build and calibrate the Micromite LCD BackPack, as detailed in the February 2016 issue of SILICON CHIP. It’s then just a matter of mounting the LCD BackPack assembly and the ultrasonic sensor assembly in separate enclosures and connecting them together. As shown in the photos, the Micromite LCD Backpack is mounted inside a UB3 ABS box, while the ultrasonic sensor goes in a smaller UB5 box. A 4-core cable joins the two units and allows the sensor to be mounted at bumper bar height, while the Micromite LCD BackPack can be mounted above it at eye height. In each case, the lid supplied with the box is discarded and replaced with a laser-cut clear acrylic panel (available from the SILICON CHIP Online Shop; see parts list). The panel for the BackPack assembly comes with all the mounting holes plus a precision cut-out for the touch-screen LCD, while the panel (or lid) for the UB5 box comes with corner mounting holes plus neat circular cutouts for the two ultrasonic transducers. Fig.4 shows how the LCD BackPack assembly is mounted. First, the touchscreen LCD is attached to the acrylic lid at each corner using an M3 x 10mm machine screw, two stacked M3 washers and an M3 x 12mm tapped spacer. This arrangement ensures that the LCD sits flush with the clear acrylic lid. Note that the LCD itself is offset to the left on its PCB, so be sure to fit the module the right way around, so that the viewing area is centred horizontally on the acrylic panel. Once it’s in place, the Micromite BackPack PCB is then plugged into CON3 on the LCD board and secured in place using M3 x 6mm machine screws. siliconchip.com.au This view shows the LCD/BackPack PCB assembly just before it is lowered into the case. The next step is to drill holes in the lefthand side of the case to accept a panel-mount DC power socket and a 4-pin microphone socket (used for the sensor connection). These holes can be centred vertically on the panel, with each hole about 20mm in from its adjacent outside edge. Drill small pilot holes to start with, then carefully enlarge each hole to size using a tapered reamer, so that the part just fits. That done, the DC socket can be wired to a 4-pin female header as shown in Fig.5, with the red wire going to the centre pin terminal. The DC socket is then be secured to the case, after which the microphone socket can be fitted and wired to an 8-pin female header – see Fig.6. March 2016  31 5V 4 Tx 3 2 Rx 1 USB CONNECTOR TYPE A MALE GND DC PLUG DC INPUT SOCKET (ON END OF BOX) 4-PIN FEMALE HEADER CONNECTOR MICROMITE CON1POWER AND CONSOLE CONNECTOR Fig.5: the Garage Parking Assistant is powered from a standard USB plugpack charger. To make a suitable power cable, cut off one end of a USB cable (retaining the type A male connector on the other end) and solder the red wire to the centre terminal pin of a DC plug and the black wire to the outside pin. The matching DC socket is mounted on the side of the UB3 box and is connected to a 4-pin female header which then plugs into CON1 on the Micromite PCB. 21 22 GND ECHO 3.3V TRIG 5V +5V 4-PIN FEMALE HEADER CONNECTOR ULTRASONIC DISTANCE SENSOR GND 4-PIN MICROPHONE PLUG 4-PIN MICROPHONE SOCKET ON END OF BOX 8-PIN FEMALE HEADER CONNECTOR MICROMITE CON2 I/O CONNECTOR Fig.6: a cable with a 4-pin female header at one end and a 4-pin microphone plug at the other end connects the ultrasonic sensor to the display unit via a matching 4-pin socket. The microphone socket in turn is wired to an 8-pin female header which then connects to CON2 on the Micromite PCB. Note that the female headers shown in Figs.5 & 6 are not polarised, so make sure that they are orientated correctly when plugging them in. The main unit can now be completed by plugging the headers into CON1 & CON2 on the BackPack PCB, then lowering the PCB assembly into the case and securing it at the corners using the supplied self-tapping screws. Be careful when plugging in the two headers, as the connectors are not polarised. Basically, it’s just a matter of making sure that ground (GND) from the DC socket (black wire) goes to GND on CON1 and that GND on the microphone socket goes to GND on CON2. Note also that CON2 on the BackPack PCB has 18 pins; the 8-pin female header must be plugged in at the end that has the GND pin. Fitting the sensor PCB The ultrasonic sensor unit comes pre-assembled. It’s just a matter of pushing the two sensors through their The sensor unit is connected to the Micromite LCD Backpack via a 4-core cable. Power is derived from CON2 on the BackPack PCB. 32  Silicon Chip front panel holes as far as they will go to secure the unit in position. The sensors are a firm fit in the holes and that will usually be enough to hold the assembly in place. Alternatively, a couple of small dabs of neutral-cure silicone can be used on the inside to ensure that the sensor unit can’t be pushed back into the case. The next step is to drill a 9.5mm hole through one side of the case (or through the top) and fit a rubber grommet. A 4-way cable (used to connect the sensor to the Micromite BackPack PCB) is then pushed through this grommet and wired to a 4-way female header as shown in Fig.6. Either 6mm-diameter 4-core audio cable (with the shield braid cut short) or 4-wire telephone cable can be used here. The audio cable is a tight fit into the grommet, so it won’t be necessary to secure it with a cable clamp. Conversely, some sort of clamping arrangement will probably be required if telephone cable is used. The other end of this 4-way cable is connected to a 4-pin microphone plug. Make sure that the wires go to the correct pins on this plug, so that they mate with the correct wires on the socket when the two are connected together. If you are using audio cable, the shield braid can either be cut short or connected to the plug’s metal shell. siliconchip.com.au Firmware Updates For firmware updates for the Micromite and the Garage Parking Assistant, please check the author’s website at geoffg.net/micromite.html Note that the ultrasonic sensor assembly derives its power (5V) via this cable from CON2 on the Micromite BackPack PCB. Power supply 5V USB plugpack chargers are cheap and the Garage Parking Assistant works perfectly with one of these. Be sure to select one with a generous current rating (500mA or more), as the unit can draw up to 250mA. Fig.5 shows the details for the USB supply cable for one of these supplies. It’s just a matter of cutting off one end of a USB cable (retaining the male type A connector at the other end) and soldering the red and black wires to the DC plug (red wire to the centre-pin terminal). The other two wires in the USB cable (generally green and white) can be cut short, as they are not needed. Another option is to use a 5V DC plugpack with a captive lead fitted with a DC plug. If the plug is the incorrect size, cut it off and fit one that does match the socket. Loading BASIC If you are going to load the BASIC program yourself or edit it later, you also need to make up a cable with a USB-to-serial converter as described last month. Then, after you have the program running, you can remove the converter and use the power cable instead. This is because the program is designed to start running automatically whenever power is applied and after the program has been run once, you don’t need to use the console again. Mounting it in place Having made the connections, the next step is to mount the two units in place. The LCD unit should be mounted on the garage wall at eye height, while the sensor should be mounted at bumper bar height. Don’t forget that you can easily adjust the green, yellow and red threshold values if necessary. Depending on how close you want to park to the wall, the siliconchip.com.au Parts List Micromite LCD BackPack Unit 1 PCB, code 07102122, 86 x 50mm (for 2.8-inch LCD) 1 ILI9341-based LCD, 320 x 240 pixels, 2.8-inch diagonal 1 UB3 ABS box, 130 x 67 x 43mm (Altronics H0153 or H0203, Jaycar HB6013 or HB6023) 1 pre-drilled clear acrylic lid to suit UB3 box 1 4-pin tactile switch, throughhole hole 1 100Ω vertical-mount side adjust trimpot (Altronics R2579, element14 9608044 or similar) 1 28-pin DIL low-profile IC socket 1 4-pin 0.1-inch male header (CON1) 1 18-pin 0.1-inch male header (CON2) 1 14-pin 0.1-inch female header socket (CON3) 1 6-pin 0.1-inch right-angle male header (CON4) 1 4-pin 0.1-inch female header 1 8-pin 0.1-inch female header 1 2.1mm or 2.5mm panel-mount DC socket (Altronics P0622 or P0623) 1 4-pin panel-mount microphone male socket (Altronics P0955 or Jaycar PP2010) 4 M3 x 12mm tapped spacers 4 M3 x 10mm machine screws 4 M3 x 6mm machine screws 8 M3 flat washers Semiconductors 1 PIC32MX170F256B-50I/SP microcontroller programmed with ParkingAssistFull.hex (IC1) – see text. Note: a PIC32­ MX170F256B-I/SP can also be used but will be limited to 40MHz) 1 Microchip MCP1700-3302E/TO voltage regulator (REG1) Capacitors 1 47µF 16V tantalum or SMD ceramic (3216/1206) default values should be fine in most cases. However, some people might want to increase the red threshold to (say) 15cm or even 20cm. As stated earlier, all you have to do is touch the screen to bring up the main options menu and then touch the 2 10µF 16V tantalum or SMD ceramic (3216/1206) 2 100nF monolithic ceramic Resistors (0.25W 5%) 1 10kΩ Sensor Unit 1 ultrasonic distance sensor, HCSR04, SRF05, SRF06, Parallax PING or DYP-ME007 1 UB5 ABS box, 82 x 54 x 30mm (Altronics H0155 or H0205 , Jaycar HB6005) 1 pre-drilled clear acrylic lid to suit UB5 box 1 9.5mm rubber grommet to suit 6mm-dia. cable (Jaycar HP0702) Cable Parts 1 USB cable with a male type A connector (length to suit) 1 2.1mm or 2.5mm DC plug to suit DC socket (Altronics P0634A or P0635A, Jaycar PP0510 or PP0511) 1 4-pin female line microphone connector (Altronics P0950 or Jaycar PS2012) 1 4-pin 0.1-inch female header 1 length 4-core audio cable 1 200mm length of rainbow cable Where To Buy Parts A complete kit for the Micromite LCD BackPack is available from the SILICON CHIP Online Shop. The clear lid with cut-out, to suit a UB3 Jiffy box, is available separately. We are also offering the ultrasonic distance sensor with a custom-cut UB5 jiffy box lid. See the Online Shop ad on page 88 for more details. The Micromite BackPack PCB and programmed microcontroller can also be purchas­ed separately. Note that the kit does not include the boxes, mounting hardware, plugpack power supply, rubber grommet off-board headers and connectors or cable parts. CHANGE button for the colour thresh- olds to bring up the relevant options menu. You then hit the CHANGE button for the threshold you want to change, enter in the new number on the virtual keypad, touch ENT and then FINISHED, SC and that’s it! March 2016  33