The Micromite MkII
The Micromite MkII is a Microchip PIC32MX170F256 series microcontroller programmed with the free MMBasic firmware. This $4 chip is available in an easy to use 28-pin dual in line package which can be readily soldered and plugged into an IC socket.
MMBasic is a Microsoft BASIC compatible implementation of the BASIC language with floating point, integer and string variables, arrays, long variable names, a built in program editor and many other features.
Using MMBasic you can use communications protocols such as I2C or SPI to get data from a variety of sensors. You can measure voltages, detect digital inputs and drive output pins to turn on lights, relays, etc.
Special features include an IR remote control receiver and the ability to easily use LCD displays, keypads, temperature sensors, distance sensors and more.
All from inside this cheap 28 or 44-pin chip.
The Micromite MkII was introduced in the January 2015 issue of Silicon Chip magazine. You can use it as the intelligence inside any project that requires a medium speed microcontroller but without the hassle of programming in a complex language.
Back issues of the article can be purchased from Silicon Chip or electronic access can be purchased for about the cost of the printed issue.
The Micromite MkII uses a more modern chip with double the memory and has over 50 new features including:
Because the difference in cost between the old chip and the new is only only a few cents it is recommended that all new designs use the MkII version. However, if you have a few of the older chips around, you can still download the original Micromite firmware from the download section at the bottom of this page.
Micromite MkII Features
- A fast 32 bit CPU with 256K of flash and 64K RAM running a powerful BASIC interpreter. 80KB of non volatile flash memory is reserved for the program. 52KB of RAM is available for BASIC variables, arrays, buffers, etc. This is sufficient for quite large BASIC programs up to 2500 lines or more and typically it will execute a program at 30,000 lines per second.
- The Microsoft compatible BASIC interpreter is full featured with floating point, 64-bit integers and string variables, long variable names, arrays of numbers or strings with multiple dimensions, extensive string handling and user defined subroutines and functions.
- Compiled C or assembler routines can be inserted into the BASIC program for speed or to access special features of the PIC32 microcontroller.
- Nineteen input/output pins are available on the 28-pin chip and 33 I/O pins on the 44-pin chip. These can be independently configured as digital input or output, analog input, frequency or period measurement and counting. Ten or more of the pins can be used to measure voltages and another seven or more can be used to interface with 5V systems.
- Programming and control is done via a serial console (TTL voltage levels) at 38400 baud (configurable). Once the program has been written and debugged the Micromite can be instructed to automatically run the program on power up with no user intervention. Special software is not needed to develop programs.
- A full screen editor is built into the Micromite. This only requires a VT100 terminal emulator and can edit a full program in one session. It includes advanced features such as search and copy, cut and paste to and from a clipboard.
- Easy transfer of programs from another computer (Windows, Mac or Linux) using the XModem protocol or by streaming the program over the serial console input.
- Input/Output functions in MMBasic will generate pulses (both positive and negative going) that will run in the background while the program is running. Other functions include timing (with 1 mS resolution), BASIC interrupts generated on any change on an input pin and an internal real time clock.
- A comprehensive range of communications protocols are implemented including I2C, asynchronous serial, RS232, IEEE 485, SPI and 1-Wire. These can be used to communicate with many sensors (temperature, humidity, acceleration, etc) as well as for sending data to test equipment.
- Built in commands to directly interface special devices such as infrared remote controls, the DS18B20 temperature sensor, LCD display modules, battery backed clock, distance sensors, numeric keypads and more.
- Up to five PWM or SERVO outputs can be used to create various sounds, control servos or generate program controlled voltages for driving equipment that uses an analogue input (eg, motor controllers).
- Special embedded controller features in MMBasic allow the clock speed to be varied to balance power consumption and speed. The CPU can also be put to sleep with a standby current of just 90µA. While in sleep the program state and all variables are preserved. A watchdog feature will monitor the running program and can be used to restart the processor if the program fails with an error or is stuck in a loop.
- The running program can be protected by a PIN number which will prevent an intruder from listing or modifying the program or changing any features of MMBasic.
- Power requirements are 2.3 to 3.6 volts at 6 to 31mA.
Remember, all of the above features are internal to the Micromite MkII. The only extra component required is a 47µF capacitor.
To illustrate how easy it is to use the Micromite, part 1 of the Silicon Chip article (May 2014) described a GPS controlled digital clock based on the Micromite. The rear of the clock is shown here and, as you can see, it uses just a few components. It is always accurate to a fraction of a second and never needs setting. A more detailed description of the clock can be found here.
There are two versions of the Micromite:
- A 28-pin version based on the Microchip
microcontroller is an easy to use 28-pin dual inline package (DIP) that can be plugged into a breadboard or an IC socket.
It has 19 I/O pins for interacting with the external world and is shown on the right, plugged into a breadboard.
- A 44-pin version based on the Microchip PIC32MX170F256D microcontroller. It has all the features of the 28-pin version plus 33 I/O pins which are under the control of your BASIC program. This is a surface mount chip but there are many ways to use this including soldering it onto a header board or by using the Micromite Module. See, "Where Can I Get It" below.
The best way to get started is to download the Micromite User Manual or the firmware from the download section below. The manual runs to almost 80 pages and includes all that you need to know about programming and using the Micromite.
The cost is zero, so why not give it a go?
Where Can I Get It?
The Micromite User Manual lists the exact part numbers of the chips that you can use for both the 28 and 44-pin versions of the Micromite.
The 28-pin version is available from a variety of sources:
- Micromite.org sell the 28-pin chip pre-programmed for £5.50. They also have a wide range of developer's boards for the 28-pin chip and other Micromite items.
- CircuitGizmos offer the 28-pin version pre-programmed with MMBasic for US$6.49.
- The Silicon Chip online store sell the 28-pin chip pre-programmed for A$15 (including the 47µF capacitor).
- Mick on the Back Shed forum has developed a number of nice experimenter's board for the 28-pin chip (see this link) which he can supply as a blank board or with a pre-programmed Micromite MkII chip. Mick's boards are also available from Micromite.org.
- Microchip Direct sell the blank microcontroller for US$4.03 (for a single chip). Other suppliers such as Element 14, RS Components, etc also sell the blank chips at a slightly higher cost. You will need a programmer such as the PICKit 3 to load the MMBasic firmware into the chip - this is easy to do, see my tutorial at: geoffg.net/programming_pics.html
Because the 44-pin chip is surface mount you need to solder it on a printed circuit board (PCB) for it to be useful.
Micromite.org sell an excellent adapter board (the Micromite Module) that includes the pre-programmed 44-pin chip, a USB-to-serial bridge and voltage regulator as illustrated on the right. They sell the board in a variety of forms including the blank board and a fully assembled and tested version. This is definitely the best way to go if you need the full 33 I/O pins that the 44-pin version offers.
You can also buy the bare chip (not mounted on a PCB). To use the chip you would need to buy a mounting printed circuit board such as Part Code: 44PINTQFP from Futurlec which costs US$1.20. Micromite.org also sell the blank board for their module (described above) and you can solder the chip to that board.
Suppliers of the bare (un mounted) chip include:
- Micromite.org who sell the bare 44-pin chip programmed with the Micromite MkII firmware.
- The Silicon Chip online store also sell the bare 44-pin chip programmed with the Micromite MkII firmware.
- Microchip Direct sell the blank 44-pin microcontroller for US$4.09 as do the normal distributors (at a slightly higher price). You will need a programmer such as the PICKit 3 (or a clone) to load the MMBasic firmware into the chip (see this page for details).
Interesting Web Sites
A video review of the original Micromite (almost everything applies to the Micromite MkII):
A website that sells the 44-pin version of the Micromite MkII, Micromite chips and all sorts of support parts:
The Back Shed forum is a great place to hang out and discuss the Micromite and microcontrollers:
A new versions of MMBasic for the Micromite MKII is available from the download area at the bottom of this page. This is a minor updates that fixes a few bugs and adds support for NEC IR remote controls and a number of Maximum/Dallas real time clocks (eg, DS1307). Details are in the Change Log which is included in the download.
To load the new version you will need a PIC32 programmer. The best (and cheapest) programmer is the PICKit 3 by Microchip. Prices range from US$20 for a clone and it is easy to update the firmware - see this page for a tutorial.
To save you from having to check this web page for firmware updates I can also send you an email. To enable this please enter your email address in the box below and click on Submit. Your address will be held confidential and will only be used when an update is available.
The first thing that you should read is the Micromite Frequently Asked Questions (FAQ) list as this covers hints related to usage and programming. The list is rather short at this time but as more questions arise it will be expanded.
Also, you should check the list of current bugs found in the Micromite version of MMBasic as it lists any faults found in the current version and provides workarounds if applicable.
The Back Shed has an active forum where many knowledgeable users are happy to help newcomers to the Micromite and MMBasic: http://www.thebackshed.com/forum/Microcontrollers
Source Code to MMBasic
The complete source code for the Micromite version of MMBasic is available for personal use at the main MMBasic website at http://mmbasic.com.
|Micromite MkII User Manual||DOWNLOAD|
|Micromite MkII Firmware V4.6B (includes a copy of the Micromite User Manual)||DOWNLOAD|
|Original Micromite Firmware 4.5E for the PIC32MX150F128 chip||DOWNLOAD|
|MMEdit, a full featured editor for MMBasic (it runs on your PC). By Jim Hiley||WEB SITE|
Previous versions of the Micromite firmware can be found in the archive.