Silicon ChipThe MiniMaximite Computer - November 2011 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Mains surge suppressors are not a condition of electronic product warranties
  4. Feature: Power Your Pedal Pushie (Or Building An eBike) by Ross Tester
  5. Feature: Steadicam: Taking The Bumps Out Of Movies, Pt.1 by Barrie Smith
  6. Project: Build A G-Force Meter by Andrew Levido & Nicholas Vinen
  7. Project: The MiniMaximite Computer by Geoff Graham
  8. Project: Ultra-LD Stereo Preamplifier & Input Selector, Pt.1 by John Clarke & Greg Swain
  9. Review: Tektronix MDO4104-3 Mixed Domain Oscilloscope by Nicholas Vinen
  10. Project: 2.2-100V Zener Diode Tester by John Clarke
  11. Vintage Radio: The Astor P7G 8-Transistor AM Portable Radio by Rodney Champness
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the November 2011 issue of Silicon Chip.

You can view 26 of the 104 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.

Articles in this series:
  • Steadicam: Taking The Bumps Out Of Movies, Pt.1 (November 2011)
  • Steadicam: Taking The Bumps Out Of Movies, Pt.1 (November 2011)
  • Steadicam: Taking The Bumps Out Of Movies, Pt.2 (December 2011)
  • Steadicam: Taking The Bumps Out Of Movies, Pt.2 (December 2011)
Items relevant to "Build A G-Force Meter":
  • Digital Spirit Level/Inclinometer or G-Force Meter PCB [04108111] (AUD $10.00)
  • PIC18LF14K22-I/P programmed for the G-Force Meter [0410811C.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (HEX file) and C source code for the G-Force Meter (Software, Free)
  • Digital Spirit Level/Inclinometer/G-Force Meter PCB pattern (PDF download) [04108111] (Free)
  • G-Force Meter panel artwork (PDF download) (Free)
Items relevant to "The MiniMaximite Computer":
  • miniMaximite Microcomputer PCB [07111111] (AUD $10.00)
  • PIC32MX695F512H-80I/PT programmed for the Maximite/miniMaximite (V2.7) (Programmed Microcontroller, AUD $30.00)
  • MaxiMite Firmware v4.1, documentation, libraries, sample software, serial port driver and sprint/font editor (Free)
  • miniMaxiMite PCB pattern (PDF download) [07111111] (Free)
Items relevant to "Ultra-LD Stereo Preamplifier & Input Selector, Pt.1":
  • Input Switching Module PCB for the Low Noise Preamplifier [01111112] (AUD $15.00)
  • Input Selection Pushbutton PCB for the Low Noise Preamplifier [01111113] (AUD $5.00)
  • Preamp & Remote Volume Control PCB for the Ultra-LD Mk3 [01111111] (AUD $30.00)
  • PIC16F88-I/P programmed for the Low-Noise Stereo Preamp [0111111B.HEX] (previously 0111111A.HEX) (Programmed Microcontroller, AUD $15.00)
  • Firmware and source code for the Low-Noise Stereo Preamplifier [0111111B.HEX] (previously 0111111A.HEX) (Software, Free)
  • Low-Noise Stereo Preamplifier Input Switcher PCB pattern (PDF download) [01111112] (Free)
  • Low-Noise Stereo Preamplifier Input Selector Pushbutton PCB pattern (PDF download) [01111113] (Free)
  • Low-Noise Stereo Preamplifier Main PCB pattern (PDF download) [01111111] (Free)
Articles in this series:
  • Ultra-LD Stereo Preamplifier & Input Selector, Pt.1 (November 2011)
  • Ultra-LD Stereo Preamplifier & Input Selector, Pt.1 (November 2011)
  • Ultra-LD Stereo Preamplifier & Input Selector, Pt.2 (December 2011)
  • Ultra-LD Stereo Preamplifier & Input Selector, Pt.2 (December 2011)
Items relevant to "2.2-100V Zener Diode Tester":
  • Zener Diode Tester PCB [04111111] (AUD $10.00)
  • Zener Diode Tester PCB pattern (PDF download) [04111111] (Free)
  • Zener Diode Tester panel artwork (PDF download) (Free)
The miniMaximite miniM Maximite A few months ago we described the Maximite, a small computer running the BASIC programming language. It could be used for many tasks and it was enthusiastically adopted by our readers. We now add to the Maximite family with the miniMaximite; a small, low-cost version designed for use as an intelligent controller to plug into your creation. It is fully software compatible with the original Maximite so you can develop and test your program on the larger version, then transfer it to the miniMaximite when you are ready to screw the covers down. By Geoff Graham T he Maximite computer, described in SILICON CHIP in March, April and May of this year has proved to be an unprecedented hit. By now over a thousand Maximites of various types have been built by enthusiastic readers. Altronics has struggled for months to keep up with demand for kits, with each production run being sold out even before it was ready for sale. The urge to play with the Maximite was so strong that it led many constructors to make their own PCBs or load the firmware onto Microchip evaluation boards or wire up their own breadboards. The demand has also led to a growing Maximite ecosystem which even includes a number of Maximite clones (with approval, of course) from Dontronics (www.dontronics.com). You can tell that you are popular when companies clone your creation; after all it happened to IBM with the PC clones, so why not SILICON CHIP? Other companies have developed plug in boards and other accessories. For a full list of Maximite resources see the panel on page 38. The readers who embraced the Maximite fell into one of three broad categories: they wanted to build a small computer and learn programming, or they wanted to use the Maximite to control something such as a home automation system. The final group just wanted to revisit the nostalgic days of yore when the Tandy TRS-80 and Commodore 64 dominated the personal computer landscape. 34  Silicon Chip The miniMaximite described in this project is designed for the middle category of readers – those who want to embed the Maximite in a larger system as an intelligent controller. Because the miniMaximite is 100% software compatible with its larger cousin you can develop your program on the full Maximite and when you are ready, copy the program to the miniMaximite and plug it into your circuit. The “original” Maximite Just to recap for readers who missed the Maximite articles – the Maximite is a small computer running a full featured BASIC interpreter including floating point numbers, string handling, arrays and much more. The Maximite features a built-in VGA or composite video output and input from a standard IBM PS/2-compatible keyboard. It also has a USB interface for communicating with your PC and loading new versions of the firmware. All you need to do is plug in a monitor, keyboard and 9V power pack and you are immediately ready to start writing your own program. You can type it in, test it and then siliconchip.com.au CON5: VIDEO, KEYBOARD AND SOUND CON2: EXTERNAL I/O CONNECTORS LED1 POWER, FIRMWARE ACKNOWLEDGE S 1: BOOTLOAD CON4: USB CONNECTOR Fig.1: enlarged significantly for clarity (actual PCB size is 78 x 38mm), this shows the main features of the miniMaximite. Despite its small size, the miniMaximite can do everything its larger cousin can do and is fully software compatible with it. This means that you can develop on the Maximite and move you program to the miniMaximite when you are ready. CON6: SD CARD SIGNALS CON1: EXTERNAL I/O CONNECTORS save it to the built in SD card interface, all on the Maximite without the intervention of a larger computer such as a PC. The Maximite also has also 20 input/output lines which can be independently configured as analog inputs, digital inputs or digital outputs. You can measure voltage, frequencies, detect switch closure etc and respond by turning on lights, closing relays etc – all under control of your BASIC program All of this is accomplished using a single low-cost chip! The miniMaximite The idea behind the miniMaximite is simple: to shrink the Maximite down to the size of a large postage stamp while keeping it 100% compatible with the larger version in its external I/O capabilities and programming language. The only items that the miniMaximite is missing are the connectors for the VGA, keyboard, sound and SD card. You can add them to the miniMaximite if you wish; the signals are brought out onto header pins. But we expect that usually, the miniMaximite will be driving an LCD or indicator LEDs and using pushbuttons for inputs. For this reason you should not think of the miniMaximite as a replacement for the full sized Maximite. It is a minimalist version designed to add intelligence to your next creation. In fact, you should have both Maximites: develop your program on the full Maximite and when you are ready, copy the program to the miniMaximite embedded in your circuit. The best part is that they’re cheap enough to enable you to do this! A quick tour The best way to describe the miniMaximite is to take a tour of the assembled PCB with the aid of Fig.1. It could also help to refer to the articles describing the full-size Maximite. The first items to note are CON1 and CON2. These are the external I/O connectors and each I/O pin can be configured to measure voltages, frequency, contact closures and more. They can also be configured as outputs to control relays, LEDs and drive other devices. These two connectors have the same pinouts and capabilities as CON8 (the external I/O connector) in the full sized Maximite and use the same BASIC commands to control them. The connectors on the miniMaximite are positioned so that they can be plugged into a breadboard or strip board for prototyping and small-scale assemblies. You can also convert them to the standard Maximite 26 pin IDC cable using two connectors - this is described later. LED1 is the power indicator and it will illuminate when the firmware has passed its tests and the unit is operating correctly. It also flashes when the miniMaximite is ready to receive a firmware update. CON4 is a mini-USB connector for linking the miniMaximite to a normal personal computer. You can then edit and download programs to the miniMaximite just the same as you could on the larger Maximite. If you hold down the pushbutton switch (S1) when power is applied, the Maximite will enter the bootload mode. In this mode it changes how the USB port appears to the personal computer (it emulates a HID device) and can receive software updates from the PC. In case you missed it . . . The Maximite: kits are available from Altronics. siliconchip.com.au Here’s the Maximite Computer, as published in the March, April and May 2011 issues of SILICON CHIP. It’s created an enormous amount of interest since publication with more than 1000 kits sold – and it’s even spawned its own websites and special interest groups. The new miniMaximite is functionally identical to the original but is intended for those who wish to embed it in other projects. November 2011  35 CON5 and CON6 are the header pins that carry the signals for the missing video, keyboard and SD card connectors. If you need any of these capabilities you can wire these pins to a standard connector, however we expect that most constructors would prefer to use the full-sized Maximite if they want these features. The PCB is designed so that you can cut it on the dotted line and remove the extraneous headers resulting in a neat, minimalist PCB that can easily plug into a motherboard inside your creation. You can easily change the default drive to the internal flash drive by using the command DRIVE “A:” and subsequently return the default to the SD card with DRIVE “B:”. Setting the default drive means that you do not need to use the prefixes A: or B: to specify the drive. For example, the following two program fragments will work the same: New firmware 10 DRIVE “A:” 20 OPEN “DATA.TXT” FOR INPUT AS #1 Astute readers will have already noticed that the miniMaximite does not include an SD card for program storage and as well, we encourage readers to cut off the headers carrying these signals. So how does the miniMaximite save and run a program when it is in an embedded system? The answer is a new version of the Maximite firmware (version 2.7) that uses some of the internal flash memory of the PIC32 as a virtual disk drive. This internal flash drive has a capacity of 256KB (enough for many programs) and all the commands that you use to store and load files on an SD card will work equally well on the internal flash drive. There are only two exceptions: you can have just one file open at a time and you cannot create directories. Using the new firmware the internal flash drive is designated drive A: and the SD card (if connected) will appear as drive B:. These prefixes work the same as in DOS or Windows. So, for example, you can use: SAVE “A:TST.BAS” ‘ save to internal flash or SAVE “B:TST.BAS” ‘ save to the SD card When the firmware is started, drive B: (the SD card) will be the default, even though there is no card detected in the connector. This is to maintain complete compatibility with earlier versions of the Maximite firmware. 10 OPEN “A:DATA.TXT” FOR INPUT AS #1 or On power up, the firmware will first search drive A: for the file “AUTORUN.BAS” and if found, execute that program immediately. If the file was not found on A: the search will be repeated on drive B: (the SD card, if connected) and the process repeated. Normally, when using the miniMaximite as an embedded controller, your program will be held in “AUTORUN. BAS” saved to the internal flash drive (A:) so that it will be automatically run when power is applied. Just before leaving this subject, it is worth reflecting on what this means. The Maximite was already a very capable computer running a powerful high-level language and now it has the equivalent of a flash memory card built in. And all this in a chip mounted on a module just 38 x 55mm in size. Amazing! For the “big” Maximite too! The new version of the firmware is not exclusive to the miniMaximite. It can also be loaded onto the full-sized Maximite and in fact we recommend that you do this as the latest version contains numerous bug fixes and improvements and runs faster than earlier versions. You do not have to modify your Maximite; just load the firmware using the program supplied with the update. This process is described later in this article and is quite easy to do. If for some reason you do not like the new version, you can always load the old version and revert to exactly where you were before the upgrade. The miniMaximite connected to an SD card and USB cable. You can, if you wish, connect a VGA or composite monitor, keyboard and SD card reader to the miniMaximite to make it more like a full sized Maximite. 36  Silicon Chip siliconchip.com.au One side benefit of using the internal flash memory for data storage is that it is faster than reading from and writing to the SD card. It is also handy for holding programs that need to be independent of the particular SD card that is inserted (for example, a menu program). For the people who remember the Tandy TRS‑80 or Commodore 64 this is the equivalent of attaching what was then a very expensive 5¼ inch floppy drive to your computer. However this time you don’t need a screwdriver (and deep pockets!), it is done with a simple firmware upgrade that costs nothing! XModem protocol The astute reader will not be satisfied yet. How do you get files on and off this internal drive? It is not as if you can plug the PIC32 chip into your SD card reader! This is why we also implemented the XModem protocol on the Maximite. This is a venerable standard dating from the 1970s and is used for copying files over a serial link – in this case, over the USB link to your PC. +3.3V 10 10k ICSP HEADER MCLR Vcc GND PGD PCC NC 100nF 19 7 1 2 AVdd MCLR 4x 100nF 10 26 38 57 Vdd Vcap 16 5 15 6 35 PGED1 PGEC1 Vusb SDO2A OC3 SS2A LOAD FIRMWARE 47 RC13 S1 RF1 RC14 OC2 MINI USB TYPE B 34 1 2 3 X 4 36 37 RD7 Vbus D– D+ RD6 RF0 IC1 PIC32MX795F512H-80I/PT OR PIC32MX695F512H-80I/PT CON4 RE1 RD5 1 2 RD4 USB +5V 3 PIN 1 12 4 PIN 2 13 5 PIN 3 17 6 PIN 4 18 7 PIN 5 22 8 PIN 6 23 9 PIN 7 24 10 PIN 8 27 11 PIN 9 28 12 PIN 10 30 13 SDI4 RB4 SCK4 RB3 SD04 RB6 RE0 22pF VERT SYNC 6 59 SELECT COMPOSITE 5 48 SOUND 4 49 KYBD DATA 3 55 KYBD CLOCK 2 54 58 1 47 CON5 A  LED1 +3.3V K 1 61 2 SD ACTIVITY 53 3 CARD WRITE PROTECT 52 CARD PRESENT 4 31 DATA FROM CARD 5 29 CLOCK TO CARD 6 32 DATA TO CARD 7 60 CARD ENABLE 8 1 2 RB11 RB12 RE7 RB13 RE6 RB15 RE5 RD11 22pF 1k RB10 RE2 40 8 CON6 RE3 X1 8MHz VIDEO 8 HORIZ SYNC 7 RB9 RE4 39 6 50 RB7 CON1 OSC1 RD10 RD9 OSC2 Vss 9 M INI MAXIMITE COMPUTER RD8 Vss Vss Vss 20 25 41 3 PIN 20 3 2 PIN 19 4 1 PIN 18 5 64 PIN 17 6 63 PIN 16 7 62 PIN 15 8 45 PIN 14 9 44 PIN 13 10 43 PIN 12 11 42 PIN 11 12 13 CON2 POLARISED CAPACITORS 1 1 0 0 7 V SC 22 F 6.3V 100nF 4 CON3 2011 56 +3.3V 3 22 F 6.3V – CATHODE BAND + LED 1 K IC1 A Fig.2: the full schematic for the miniMaximite. It is dominated by the microcontroller which is the only active device on the board. Power is externally supplied and should be in the range of 2.3 to 3.6V, which means that the miniMaximite could even be powered from a couple of alkaline or NiMH cells. siliconchip.com.au November 2011  37 which are the external I/O connectors carrying 20 I/O pins. The detailed signal allocation for these connectors is shown in Fig.3 and you should refer to this diagram when you are designing a circuit for the miniMaximite to plug into. 8 8 Continuing around the PIC32 microcontroller in a clockwise direction, S1 is the pushbutton switch for CON3 ICSP initiating an update of the firmware. Inside the PIC32 a 1 pullup resistor on the input for the switch is enabled. 1 1 10k 1k 10 GROUND GROUND So, when the button is pressed the input is pulled low. 5V FROM USB 3.3V POWER SUPPLY 'PIN 20' 'PIN 1' CON3 is a PICkit 3 compatible programming connec'PIN 2' 'PIN 19' tor. You would only need this if you are building your 'PIN 3' 'PIN 18' 'PIN 4' 'PIN 17' own miniMaximite with a blank chip. If you purchase IC1 'PIN 5' 'PIN 16' the miniMaximite chip as part of a kit or from SILICON 'PIN 15' 'PIN 6' 100nF 'PIN 14' 'PIN 7' CHIP the chip will be pre-programmed for you and you 47 'PIN 8' 'PIN 13' 100nF A can ignore this connector. 'PIN 9' 'PIN 12' 'PIN 10' 'PIN 11' X1 X1 is the 8MHz crystal providing the internal clock 22pF 22pF K GROUND GROUND 13 and timing for the PIC32. Within the chip this frequency 13 is divided by two them multiplied by 20 to give the main S1 CON4 CPU clock of 80MHz. This clock is then further divided to give the baud rates for the serial interface, timing for Fig.3: the PCB component overlay. It is largely surfacethe PAUSE command and timing for the internal real mount devices (SMDs) so you’ll need to be adept at soldering time clock maintained by MMBasic. these. The technique was featured in “how to” articles in the CON4 is the mini-USB connector which is used for March 2008 and January 2005 issues of SILICON CHIP. downloading programs and firmware updates. One of the To copy a file to the Maximite run the following com- great features of the PIC32 is that all of the hardware necesmand on the Maximite: sary to drive the USB bus is integrated within the chip. All we need to do is wire the connector directly to the chip. XMODEM RECEIVE “filename” At the top of the PIC32 are a number of capacitors for filtering the supply voltages to the chip. Two connect to Then, on your PC, run a terminal emulation program that Vcap, which is the internal 1.8V regulator output supplying supports the XModem protocol (we recommend Terra Term the MIPS CPU core. The 10 resistor and 100nF capacitor for Windows) and tell it to send the file using XModem. provide filtering for the analog portions of the chip (ie, the The file will be transferred over the USB and saved on the voltage measuring circuitry). Maximite using the file name specified in the command The remaining high-value capacitors provide filtering (ie, “filename”). for the 3.3V supply to the chip. The 100nF capacitors are To copy a file from the Maximite and save it on your PC placed very close to the supply pins to provide optimal use the reverse command: bypassing as larger tracks have more parasitic inductance. On the top right hand side of the chip are CON5 and XMODEM SEND “filename” CON6. These carry the signals for the missing connectors (if you wish to implement them). CON5 carries the signals On your PC instruct your terminal emulator to use the for the VGA or composite display, keyboard and sound XModem receive protocol to save the file on your PC. while CON6 carries the signals for an SD card connector. 1 1 GROUND KEYBOARD CLOCK KEYBOARD DATA SOUND OUTPUT SELECT COMPOSITE VERTICAL SYNC HORIZONTAL SYNC VIDEO 100nF 22 F BOOTLOAD LED1 CON2 100nF CON1 1 100nF 100nF 22 F CON5 CON6 3.3V (FROM CON2 PIN2) SD CARD ACTIVITY LED SD CARD WRITE PROTECT SD CARD PRESENT DATA FROM SD CARD CLOCK TO SD CARD DATA TO SD CARD SD CARD ENABLE The circuit Construction The circuit of the miniMaximite is shown in Fig 2. It is very simple as nearly everything happens inside the very capable PIC32 microcontroller. At the bottom of the schematic are CON1 and CON2 The miniMaximite mostly uses surface-mounted components. This was a deliberate design decision to reduce the PCB to practical proportions. After all, there are only 17 surface-mounted components so it is not a complicated board. Many readers might think that dealing with these small components is too hard but that is wrong. It requires a different PIC32MX795F512H-80I/PT (or PIC32MX695F512H-80I/PT) technique, that’s all. You do not need com80MHz plicated equipment, just your soldering 128K (internal) iron and some patience. MMBasic (similar to Microsoft BASIC) All the prototypes were hand soldered 20, individually configurable and if you look closely at the photographs Monochrome standard VGA or composite video you will see that the result is excellent 500mV for amplifier, sound card, etc, or hi-z speaker (nobody can accuse us of being modest). USB 2.0 and IBM keyboard We have described how to solder these 2.3-3.6V DC <at> (125mA plus peripherals) devices many times in the past (eg, March 78 x 38 x 10mm; 15g 2008 and January 2005 issues) and we At a glance . . . Processor: Clock speed: RAM: Software: I/O pins: Video output: Audio: Interfaces: Power supply: Size & weight: 38  Silicon Chip siliconchip.com.au CON1 HEADER PINS COMPONENT SIDE Parts List - MiniMAXIMITE CON2 HEADER PINS PCB 2x 26-PIN IDC CONNECTORS 22mm 26-WAY IDC RIBBON CABLE Fig 4. If you want to use the miniMaximite with an expansion unit that uses the full sized Maximite’s 26 pin IDC connector you should build this cable. It will convert the header pins to a cable that is compatible with a cable plugged into the full sized Maximite won’t repeat that here. The important factor is that, in addition to your temperature controlled soldering iron, you need to gather together just a few tools (all of these are available from the usual suspects, eg Jaycar, Altronics, element14, etc): • A good liquid flux designed for SMD work. • Fine tipped tweezers. • A x3 magnifying loupe (or x10 if your eyes are not that good). The important factor is the flux. Use plenty of it before you apply the soldering iron and the solder will flow quickly and easily. It makes your life much easier so don’t spare it. If you are new to soldering SMD devices you can watch an excellent tutorial on this subject at: http://store.curiousinventor.com/guides/Surface_Mount_Soldering/101 You should start construction with the microcontroller. As usual solder one corner pin and after checking the chip’s alignment and orientation solder the opposite pin. You can then move around the chip soldering the other pins. Use plenty of flux and, to reduce the chance of creating a solder bridge, use only a little solder on your iron’s tip. If you do get a bridge ignore it and carry on as you can come back later with solder wick to remove it. 1 1 1 1 PCB, code 07111111, 78mm x 38mm* 8MHz HC49 crystal (through hole mounting) mini USB B socket, surface mount (Altronics P1308) micro tactile push-button switch (through hole mount) Pin header strips as needed (at least 2 x 13 pin header strips will be required) Semiconductors (Surface Mount) 1 Pre-programmed PIC32MX695F512H-80I/PT or PIC32MX795F512H-80I/PT microcontroller (IC1)* 1 Green LED (1206 package) Capacitors (Surface Mount) 2 22F 6.3V low ESR Tantalum (EIA 3216 package) or 10F 6.3V X5R/X7R ceramic (3216 package) 6 100nF 1X7R ceramic (0805 package) 2 22pF ceramic (0805 package) * see Resistors (Surface Mount, 0805 package) page43 1 10k 1 1k 1 47 1 10 The remainder of the components are easy enough. You should tack solder the component on one end and then properly solder the other end. Finally return to the first end and complete the solder joint properly. Component identification The PCB has the positive side of the polarised components marked with a large + symbol. That is the easy part but discovering the polarity of the components themselves can be a challenge. SMD Tantalum capacitors have a stripe identifying the positive end, the opposite of electrolytic capacitors. If you are unsure of your capacitors you can measure their resistance with a multimeter: you will get a higher resistance when your multimeter’s positive lead is on the capacitor’s positive side. The LED should have a small dot or green stripe marking the cathode (negative) but that is not guaranteed. It is best to use the diode test function on your multimeter to Flash endurance All flash memory, including that used in SD cards, has a limited endurance to erase/ write cycles and when that limit is reached you can expect the flash memory to start producing errors. The flash memory used inside the PIC32 has a specified endurance of 1000 erase/ write cycles for each block of memory (4K bytes) which is typical for this type of memory. While that might sound low it is not a real problem due to the way that MMBasic uses the memory. When writing to the internal flash drive A:, MMBasic will spread the erase/ writes evenly over the free blocks of flash siliconchip.com.au memory. The result is that if the drive was half full you could edit and re-save a typical program file every day of every year (including Christmas day!) for 87 years and still not reach the endurance limit. Incidentally, an erase/write cycle occurs when you delete a file, overwrite a file or rename a file. A read has no effect on endurance so you can load a program or read a file as many times as you like. This 87-year lifetime will be reduced if the drive has less free space or if the files are much larger than 4K (because there are less free blocks to share the erase/write cycles). But even with the drive 75% full you could still edit/save an 8K file at the same rate for upwards of 20 years. You do need to be careful with data files created within a MMBasic program as they can be created and erased very quickly (for example once a second) and if you write a program to do that you would quickly wear out the flash memory. But you can expect a very long life if you keep erase/writes to a reasonable number. So, the message is: Leave some free space on the drive and restrict erase/writes to an average of once or twice a day and you will never wear out the flash memory. November 2011  39 HIGH DENSITY 15-PIN FEMALE D CONNECTOR CON5 PIN 8 120 VIDEO A 1N4148 MINI MAXIMITE K CON5 PIN 1 CON5 PIN 6 VERTICAL SYNC CON5 PIN 7 HORIZ SYNC 6 1 7 2 8 3 9 4 10 5 11 12 13 14 15 MINI MAXIMITE CON5 PIN 8 VIDEO CON5 PIN 7 SYNC RCA CONNECTOR 120 680 120 CON5 PIN 1 CON5 PIN 5 1N4148 Fig.5: this circuit should be used if you need to connect a VGA monitor to the miniMaximite. A K make sure. When the LED lights up the positive lead of your multimeter will be on the anode (positive) side of the component. The larger components (USB connector, pushbutton switch and the crystal) should be the last to be mounted. The USB connector is also surface mount but it is easy to solder because it has two small locating pins on the underside which match two holes in the PCB. This will keep it steady while you solder the mounting lugs and signal pins. The crystal should be the last component to be mounted as when it is in place, it will prevent soldering the signal pins on the USB connector. When you solder its leads leave the body of the crystal sitting about a millimetre above the PC board. This will make sure that its metal case does not contact the tracks that run underneath if the PCB solder resist coating is damaged. If you sourced your own parts to build the miniMaximite you will need to install a header at CON3 (the 6-pin header marked on the PCB as ICSP) and program the chip using a programmer such as the PICkit 3. The hex file is available on the SILICON CHIP website. If your miniMaximite came pre-assembled or as part of a kit, you can skip this step as the supplier should have programmed it for you. The chips are also available preprogrammed from SILICON CHIP, along with the PCB. See the panel at the end of this article. Testing Testing the miniMaximite involves connecting 3.3V to CON2 (see below for the details) and checking that the LED lights up. This is only illuminated after the firmware has initialised everything and is ready to run a program. So, if the LED comes on, you can be sure that your miniMaximite Fig 6: this circuit will interface the miniMaximite to a composite monitor. The output is 625 lines at 50Hz and will suit any TV set that is PAL-compatible is running. Conversely, if it does not illuminate you will have some fault-finding to do. In this case you should first check that your power has the correct voltage and polarity. If you have an oscilloscope, check that there is 8MHz on both leads of the crystal. Check that all the capacitors are in place; they are critical and a missing capacitor could easily prevent the processor from starting up. A common issue is not using a low ESR capacitor for C3, the 22F capacitor connected to pin 56 of the PIC32 (see the box below on this subject). Also check the LED and the 47resistor as a faulty soldering joint or polarity could be the simple reason why the LED is not coming on. The final check is to examine IC1 for shorts or defects in soldering. This will require a high-powered magnifying glass (or jeweller’s loupe) and you will need to carefully check each pin. Again, in this case, solder wick and flux paste are your best friends! Upgrading the firmware Once your Maximite is running, you will be able to update the firmware via the USB interface using a Windows PC. This applies to either the miniMaximite or full-sized Maximite. The process is quite painless and provides you with the latest and best firmware. The current version of the firmware is on the SILICON CHIP website but later you can also check if there is a more recent version on the Author’s website: http://geoffg.net/ maximite.html#Downloads When you download the zip file for the upgrade you will find that it includes a program called BootLoader.exe. This program needs to be installed on your PC and this process is described in the instructions that also come with the upgrade. Issues with the tantalum capacitors If your Maximite (mini or full sized) does not start up the problem could be caused by the 22F capacitor connected to pin 56 (Vcap) of the PIC32. A reliable indicator of this fault is that the power LED does not come on and the Maximite will draw very little current (normal consumption is 40  Silicon Chip about 125mA). This capacitor must be a low ESR Tantalum type and the PIC32 is very sensitive to its characteristics. If you suspect that it is causing trouble, try replacing it or paralleling it with a higher value and/or a higher working voltage (both of these will generally improve the ESR). Also try replacing it with another brand. Some readers have had success by wiring another Tantalum capacitor (22 or 47F) from pin 56 of the PIC32 to the 3.3V supply. It is not certain why this would work but it is worth a try. siliconchip.com.au To start the upgrade process hold down the button S1 (marked bootload on the PCB) while you apply power. The LED will rapidly flash to show that it is in the upgrade mode. Connect the Maximite to your PC via USB and run the BootLoad.exe program. In the program click on the “Load Hex File” button and navigate to where the upgrade file is on your PC (the new firmware will have the extension “.hex”). When you have loaded the hex file you can click on the “Program Device” button and the flash memory in your Maximite will be erased, programmed and verified. Once this has completed the power LED will recommence flashing but at a slower rate. Cycle the power and the Maximite will now start up with the new version. When upgrading the firmware, you need to be aware that the process will also erase the virtual disk (drive A:) in the PIC32’s flash memory – so make sure that you first copy anything that needs saving. Connecting it up CON5 PIN 4 5.6k SOUND CONNECTOR 1k +5V 5 6 3 4 2 CON5 PIN 3 CON5 PIN 2 MINI MAXIMITE 1 PS2 KEYBOARD MINI DIN CONNECTOR (FRONT VIEW) +3.3V 2x 33k CON6 PIN 4 CON6 PIN 8 CON6 PIN 7 CON6 PIN 6 CON6 PIN 5 CON6 PIN 3 CON6 PIN 2 CARD PRESENT CARD ENABLE DATA TO CARD CLOCK TO CARD DATA FROM CARD SD CARD SOCKET CD 9 1 2 3 4 5 6 7 8 47 The miniMaximite needs a supply voltage of CARD WRITE PROTECT WP A 2.3V to 3.6V with a normal running voltage of 3.3V. This wide voltage range means that the  SD ACTIVITY LED miniMaximite could even be powered from a K CON5 couple of alkaline or NiMH cells. Bear in mind PIN 1 that the current draw is typically 125mA plus any current that might be drawn from the ex- Fig 7. If you want to connect a keyboard, SD card or use the sound output this is the wiring diagram that you will need. Most peripherals ternal I/O pins. do not need any additional components; it is just a case of wiring the Pin 1 of CON2 is the negative (ground) and header pins to the appropriate connectors. pin 2 of the same connector is the positive supply voltage. The corresponding pin in the full construct using two 26-way IDC connectors. sized Maximite is the 3.3V output but in the The header pins for CON1 plug into the top row of pins miniMaximite this pin is used to power the device. Pin 2 on CON1 corresponds to the 5V output on the full- of the first IDC connector (the uneven pin numbers) and sized Maximite. In the miniMaximite this pin carries the the header pins for CON2 plug into the bottom row of pins +5V from the USB connector (assuming that it is plugged (even pin numbers) of the second connector (see Fig.4). The result is a cable that is compatible with a cable into a host computer) and is handy if you wish to power plugged into the full sized Maximite (with the exception of your circuit from USB. If you also want to power the miniMaximite from the the pins carrying 3.3V and 5V as described above). same source you will need to provide a low dropout 3.3V regulator on your main circuit board and feed that voltage Video, keyboard and SD card You can, if you wish, connect a VGA or composite moniback to pin 2 of CON2. The other pins on CON1 and CON2 are the external I/O tor, keyboard and SD card reader to the miniMaximite to signals that you can manipulate from within your BASIC make it more like a full-sized Maximite. If you refer to Fig.3, you can easily identify the signals program. For example, the following program will flash a LED connected to the line referred to as pin 12 in MMBasic available on these connectors. Fig.5 illustrates how you can connect up a VGA monitor while Fig.6 shows how to (pin 11 of CON2) at 1Hz. connect a composite monitor (eg, a TV). Fig.7 shows the wiring for the sound, keyboard and SD card connectors. 10 SETPIN 12, 8 If you do have a video monitor connected, you will notice 20 PIN(12) = 1 that the display will blank while MMBasic is writing to the 30 PAUSE 500 internal flash drive (A:). This is because the firmware must 40 PIN(12) = 0 turn off the DMA (which drives the video) to avoid cor50 PAUSE 500 rupting the flash memory while it is being reprogrammed. 60 GOTO 20 With all peripherals connected, the miniMaximite will If you want to connect the miniMaximite to an expansion run exactly the same as the full-sized Maximite – although, board or device that was designed to plug into CON8 (the as we said earlier, this is not the intended purpose of the external I/O connector) in the full sized Maximite, you will miniMaximite and we expect that most constructors will need to make up an adaptor cable. This cable is simple to cut off the PCB section holding CON5 and CON6. siliconchip.com.au November 2011  41 +3.3V (PATCH ANTENNA) 1k MINI MAXIMITE Vcc 5 EM-408 GPS RX MODULE 1 ENABLE 3 Rx Tx GND 4 DATA FROM MAXIMITE PIN16 (COM1) OR DATA TO MAXIMITE 2 PIN18 (COM2) PIN15 (COM1) OR PIN17 (COM2) GROUND Fig 8. An example of how to connect the Maximite’s serial interface to a device that uses a serial interface with TTL voltage levels. The “MMBasic Library” on the Author’s web site (see the box “Maximite Resources”) has an example program that will read and decode the data stream. Communication capabilities One of the most requested features for the Maximite was to communicate with other devices using serial, I2C and SPI protocols. These protocols are used to interface with a variety of devices and chips ranging from GPS receivers through memory chips to speech synthesisers. These protocols are doubly important for a “plug in chip” styled device like the miniMaximite as it will need to cooperate with a variety of other chips in an embedded system. So, it should come as no surprise that we have implemented these protocols in the latest versions of the firmware. And, just to emphasise the point, this firmware can be loaded onto the full sized Maximite so it too can communicate to these devices. Serial interface is sent from the Maximite to the external device). Similarly, when COM2 is enabled it will take control of pins 19 (receive data) and 20 (transmit data). The data is logic high when the output/input voltage is high. This is the standard when connecting serial devices that use standard TTL logic levels and it makes it easy to connect to another device such as a GPS module as illustrated in Fig.8. The “MMBasic Library” on the Author’s web site (see the box “Maximite Resources”) has an example program that will read the data stream from the GPS module and extract information such as the current latitude and longitude. To interface to a personal computer or a modem, you need to convert the signal levels to the RS232 standard (±12V) using a chip such as the popular MAX232. Fig.9 shows a typical circuit to achieve this. To enable serial communications you use the open command as follows: OPEN “COM1:9600” AS #1 This will enable the COM1 serial interface and take control of the external I/O pins 15 (Rx) and 16 (Tx). The baud rate is set to 9600 bits per second and you can use the file identifier (#1) in exactly the same manner as if you were reading or writing data from a disk file. For example, you can use commands such as PRINT #1, “data” to send data and INPUT$(1, #1) to receive a character. When you have finished, you can close the serial interface with the command CLOSE #1, which will return control of the I/O pins to the SETPIN and PIN commands. One useful feature of the serial interface is that you can issue the command: OPEN “COM1:2400” AS CONSOLE This will open the COM port, set the baud rate to 2400 and attach it to the input and output data streams from MMBasic. Anything received from the COM port will be sent to the MMBasic interpreter as if it had been typed on the keyboard. Similarly, any output to the video screen (except graphics commands) will be sent out on the COM port’s transmit line. This means that you can enter data and control the Maximite via an external serial link. This link could be connected to a modem or even to a serial/Ethernet module for remote control of the computer or the program running on it. When a COM port is opened as a console it will remain in this mode, regardless of commands such as NEW and RUN which normally close all files and COM ports. The MINI MAXIMITE only way to terminate this mode is with a CLOSE CONSOLE command. Typically, the command to open a port PIN16 (COM1) OR PIN18 (COM2) as a console would be included in the “A:AUTORUN.BAS” file so that the console PIN15 (COM1) OR There are two serial interfaces available, labelled COM1 and COM2. The syntax and method of using them is compatible with Microsoft BASIC (as is most of MMBasic) so if you are familiar with that language you can jump right in. When enabled, COM1 will take over pins 15 and 16 on the Maximite’s external I/O connector. This overrides the SETPIN and PIN commands which normally control these I/O pins. Pin 15 becomes the receive line for COM1 (input to the Maximite) while pin 16 becomes the transmit line (the data +5.0V 16 1 F 16V DB9F CONNECTOR 1 F 16V 1 6 2 7 3 8 4 9 5 2 6 1 4 3 MAX232 5 1 F 16V 1 F 16V 14 11 DATA FROM MAXIMITE 13 12 DATA TO MAXIMITE PIN17 (COM2) 15 GROUND 42  Silicon Chip Fig.9: if you want to connect the Maximite’s serial interface to a modem or other device that uses RS232, you will need to convert the voltage levels to ±12V as required by the standard. This circuit uses the popular MAX232 chip to do just that. siliconchip.com.au PCBs and Programmed PICs +5.0V 32.768kHz 8 7 1 2 MAXIM DS1307 3 3V COIN BATTERY MINI MAXIMITE 2x 4.7k 6 SCL (CLOCK) 5 SDA (DATA) PIN 13 PIN 12 4 GROUND Fig 10. Many chips use the I2C protocol – this diagram shows how to connect such a component to the Maximite, in this case the Maxim DS1307 real time clock chip. is immediately setup on power up. I2C interface The Inter Integrated Circuit (I2C) bus was developed by the electronics giant Philips for the transfer of data between integrated circuits. The protocol has been adopted by many manufacturers and you can now buy devices including memory chips, timekeeping chips, speech synthesisers and more – all using the I2C interface. When enabled the I2C interface will take control of pins 12 and 13 on the Maximite’s external I/O connector. As with the serial interface this will override the SETPIN and PIN commands which normally control these I/O pins. When the I2C interface is closed control is returned to these commands. Pin 12 becomes the I2C data line (SDA) and pin 13 the clock (SCL). Both of these pins should have external pullup resistors installed (a typical value is 4.7k connected to +5V). Fig.10 illustrates this arrangement using the popular Maxim DS1307 real time clock. Both master and slave I2C modes are fully implemented and you can have both operating simultaneously with bus speeds set anywhere in the range of 10kHz to 400kHz. Other features include optional 10-bit addressing, address masking and general call, as well as bus arbitration (ie, bus collisions in a multi master environment). The commands for controlling the I2C interface are documented in the updated Maximite User Manual so we will not go into the details here but suffice to say that all the features of the protocol are supported. SPI interface The Serial Peripheral Interface (SPI) communications For those wishing to build their own projects and source their own components, SILICON CHIP is now able to offer both the PCB and the preprogrammed PIC chip (this chip suits both the MiniMaximite and Maximite projects and comes with the latest software from Geoff Graham). See the handy order form on p102 of this issue. protocol is another popular protocol used to send and receive data between integrated circuits. In the Maximite this implementation is suitable for moving small amounts of data to and from a chip like an accelerometer but not for shifting large amounts of data from EEPROMS, etc. The SPI function in MMBasic acts as the master (ie, the Maximite generates the clock). The standard SPI signals (MISO, MOSI and CLK) can be any external I/O pin on the Maximite and the command can transfer data with up to a 500kHz clock. The SPI interface can also communicate with any number of SPI devices connected to the Maximite at the same time. Other firmware improvements Many other features have been added to the firmware to make your life as a programmer easier. For a start it now contains an editor (the EDIT command) that can be used to modify a program line in memory without having to retype the whole line. The RENUMBER command will renumber a program for you ensuring that the line numbers are neat and consistent. This command will also change any references to line numbers (for example, in a GOTO command) so that they match the new numbering scheme. The SAVEBMP command will save an image of the video screen onto the SD card or internal flash drive while the PIXEL command/function can be used to change or examine the video memory directly. Finally PEEK and POKE commands have been implemented for readers who want to get into the internal workings of the PIC32 chip and the interpreter. So there you have it, a full-featured and low-cost computer in a miniature package that you can plug into your own creation. It is easy to use and you can easily write programs for it. SC So, what will your next creation be? NEXT MONTH: We’ll have a look at some interesting Maximite/MiniMaximite applications and ideas submitted by readers! Maximite resources The author’s web site for updates and other downloads: ....................................................................................http://geoffg.net/maximite.html An active forum discussing the Maximite and other micros (a good place to start if you need help):..................................................................... ........................................................................................................................................ www.thebackshed.com/forum/forum_topics.asp?FID=16 The Altronics kit for the full sized Maximite: .................................................................. www.altronics.com.au/index.asp?area=item&id=K9550 Alternative, assembled versions of the Maximite: ........................................................... www.dontronics-shop.com/the-maximite-computer.html A large range of expansion boards for the Maximite: ..........................................................................................................www.hamfield.com.au An example of running MMBasic on a Microchip development board: ..............................................................www.elproducts.net/chips16.html A reader who could not wait for the kit to become available: ........................................................................................www.carnut.info/maximite siliconchip.com.au November 2011  43