Category Archives: Uncategorized

Code name Iron-DR – Part 2 – The Brushless Motor Controllers


Brushless motor and controller

So I had sourced the relatively cheap motor / wheel assemblies from eBay, originally  used for those hover boards. The next issue was controlling them, I could easily make my own controller but I would want it to look good so would want a professional PCB made, which is all fine, i’m a design engineer I can do all that, but the cost soon adds up. So off to eBay again, sorry, and I run across some controller boards that cost around £7 have a voltage of 12 to 36 Volts and are said to handle 500 Watts if you put a heatsink on them. So I order a couple, a few weeks pass and they arrive from China, in the typical way with very lacking documentation, well none in fact just a jiffy bag and the boards. So I look over some other suppliers of the same board and find the pin outs. So I have some pins I need to pull high / low to choose direction and enable the motor then I have a variable voltage input (0-5 Volts) for the speed. RC network to the rescue coupled with the PWM output on an Arduino, bingo variable voltage output from a Micro controller. There is also a pulse counter output, I have not played with this, but should be useful to give an indication as to how much the motor has moved.

Motor Controllers Mounted

Anyways, I hookup one of the motors on the bench, start off with a pot to change the speed of the motor, all works great, nice and easy. so I start to mount all these bit up on some old copper clad board I had laying around, all the motor controls sit nicely in between the motors, Will clean up the wiring later. Next I start writing the Arduino code, start off simple and get one side working, first with a taranis remote control and then with serial data from a PC, no problem, then I pretty much copy the code I have written to control the extra motor controller. fire her up and one side works great the other side is anything but controlled, seemingly doing whatever it wants, strange, so double check wiring. All seems to be fine, start double checking code, all seems to be in order too. so I pull the motor controller board off and stick on a spare motor I have, it works as i expect, really strange, so I stick back in the robot, try again, its does not want to play, so with a bit of head scratching I think to myself its late will pick it up again tomorrow.

So next day I double check everything again, all in order, I even write some really simple code to make the other side work. But still no play.  So I admit defeat I pull the controller out again and try it on the bench, oh I see now, wont work on the bench with the spare motor either now, so a little more messing and it seems it just likes to do random things, sometimes works sometimes doesn’t, maybe its got different firmware of maybe its just got hit by static, in any case I order two more of the controllers, which have arrived now, but I’ve not had time to fit on in.  So I will post again about my adventures with these controllers, but at the moment its a 50/50 chance of the them working, I will give credit to one that does work though, its a great cheap large brushless motor controller when hooked up to the Arduino.

DC 12V-36V 500W Brushless Motor Controller Hall Balanced Car Driver Board U5Y

Lithium Batteries

One of the difficult parts when prototyping  a new project is to find reliable power sources that don’t cost you too much. Here I’ll show how to refurbish dead battery packs by stripping them down, testing each cell and combining cells to produce a new pack.

I’ve been pretty luck with some of my recent finds, an old electric cycle lithium pack, they seemed only to have a faulty connector to almost dead Apple MacBook Pro batteries, so I decided to tear them down to see if there was something profitable.

Here is a look at them

Electric bicycle lithium battery pack
Electric bicycle lithium battery pack

Apple MacBook Pro batteries – Cell Part Numbers US604496
Apple MacBook Pro batteries – Cell Part Numbers US604496


So next step is pull the packs apart and get each individual cell out, i know this is a pain, particularly when they may already be made int eh size you want, but time spent here will save a lot headaches and pain later.

13A23 lithium cell on charge


so above we have a cell on charge, this is from the bicycle pack, didn’t find any information on google about this one but by calculation should be 4.25 amp, so a pretty good size. note start of slow, so i set the charger to 500 mA and checked regularly  while it was on my desk to make sure it was not getting warm, if it does start to get warm its a good sign that cell is dead, chuck it. equally if after charging and left unused for a few days you check the cell and find its dropped voltage say over 0.2 Volts, its a cell thats probably going to go bad, chuck it.

Go through all the cells you have, charge them and make notes of their voltages and when you come to make up your battery pack, check the cells have not lost voltage, only use the best ones you find, this is the same for the famous 18650 cells that are used in laptop batteries.

I would also recommend however tempting they seem dont get fooled into buying lithium cells from china or anyone that claims supper high capacity cells and really cheap prices, you will only get disappointed when you find out in fact they only hold a few hundred mA at best.

so why do i want these cells, what am I planing with them, I will show you all soon but for now a quick gimps (ignor the lead acid batteries on it, there just for testing as i had them to hand), enjoy – keep safe

Mechatronics – Engineering the future

Mechatronics, IoT, and Industry 4.0

Mechatronics is a term which is popping up frequently these days, by the way, it’s not new. If we recognise the first reference to it, when Japanese engineer Ko Kikuchi combined the words mechanical and electronics in 1969 then it’s been around 47 odd years.

In the UK the first MEng course in Mechatronics was established in 1985 and 3 years later in 1988 the first graduates appeared.

Multi-discipline approach for Mechatronics

So what is Mechatronics and why is it of significant importance now? Well actually it’s always been important but with IoT and the Industry 4.0 movement it’s now a go to term which captures all.

Mechatronics brings together an integrated approach to engineering which involves electronics, mechanical and computing disciplines. Most production and manufacturing facilities will employ a high degree of Mechatronics. The division between electronics and mechanical engineering is now more blurred, the outcome of this is a more integrated approach to engineering in general.

With the advent of Raspberry Pi, Arduino and similar single board computers more people are learning to code and looking at wider applications through the open source approach than ever before. Go to any Maker Fair, Fab Lab and Hacker Event and you will see Mechatronics in action.

So what is the scale of Mechatronics?

Well think about motor control, from large 3 phase inverters to small micro-processor control boards and you can see the scope of Mechatronics, even in this technology field it’s large. Now consider all the machine tools, such as laser cutters, pressing and punching tools, mix this together with packaging and conveyor systems and you can see that it’s huge, now add the IoT equation to the mix and we have something which is truly massive.

This is great news if you specialise as a Mechatronics Engineer, you are very employable and more in demand than ever before, seriously, if you want a career in engineering it’s worth considering Mechatronics. For here the field is open for Robotics, Aerospace, Motion Control, and whole host of engineering possibilities.

Moving forward it won’t be long before we are including Augmented Reality as a major part of the engineering mix (topic for another day).

Let me quantify the greater need for Mechatronic Engineers by highlighting the basic requirements of IoT, DATA.

Data is King in modern manufacturing

No big surprise here that the key to IoT is data, but consider how that data is gathered. First of all which data point’s do you need to measure to give a logical coherent output. What do you do with that data once you have it, how do you process it to make sense of it. The reason for all this data is to build efficiencies and cost saving into the system, this plays perfectly into the multi-discipline world of mechatronics.

This might sound too simplistic but who better than a mechatronics engineer to help companies remain competitive in an ever increasing environment where every second counts and inefficiencies cost millions. Asset management is reliant on great system integration and communication between processes. In industrial environments this can lead to a reduction in un-planned maintenance, with orders on specific products being placed before breakdown occurs. In manufacturing, parts are available on assembly lines just as you need them.

Robots and alike wont take over the world any time soon, buts its clear to see in a modern world they and mechatronics play an every increasing part in the world we live.


BMW E53 retro fit bluetooth, seamless intergration to existing audio system

Want to answer phone calls and stream music via bluetooth to your trusty BMW but dont wont to ruin the stock looks, well we have the ideal kit for you. a complete retro fit system adding the ability for you beloved X5 to fully utilize bluetooth streaming and giving full functionality of steering wheel controls to change tracks, answer and make calls.

for full details and pricing please contact Martins Electronics Ltd below.

Introducing the PICmicro from Microchip technology

PIC is a family of RISC microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument’s Microelectronics Division.

Microchip Technology does not use PIC as an acronym; in fact the brand name is PICmicro. It is generally regarded that PIC stands for Peripheral Interface Controller, although General Instruments’ original acronym for the PIC1650 was “Programmable Intelligent Computer”. The original PIC was built to be used with GI’s new 16-bit CPU, the CP1600. While generally a good CPU, the CP1600 had poor I/O performance, and the 8-bit PIC was developed in 1975 to improve performance of the overall system by offloading I/O tasks from the CPU. The PIC used simple microcode stored in ROM to perform its tasks, and although the term wasn’t used at the time, it is a RISC design that runs one instruction per cycle (4 oscillator cycles).

General Instrument's PIC1655
General Instrument’s PIC1655

In 1985 General Instruments spun off their microelectronics division, and the new ownership cancelled almost everything — which by this time was mostly out-of-date. The PIC, however, was upgraded with EPROM to produce a programmable channel controller, and today a huge variety of PICs are available with various on-board peripherals (serial communication modules, UARTs, motor control kernels, LCD drivers, etc.) and program memory from 512 words to 32k words and more (a “word” is one assembly language instruction, varying from 12, 14 or 16 bits depending on the specific PICmicro family).

Various PIC microcontrollers
Various PIC microcontrollers


Writing Code for PICs

PICs use a RISC instruction set, which varies in length from about 35 instructions for the low-end PICs to about 70 instructions for the high-end PICs. The instruction set includes instructions to perform a variety of operations on the accumulator and a constant or the accumulator and a memory location, as well as for conditionally executing code and jumping/calling other parts of the program and returning from them, and specific hardware features like interrupts and one low-power mode called sleep. Microchip provides a freeware IDE package called MPLAB, that also includes a software simulator as well as an assembler.

Third parties make C and BASIC language compilers for PICs. Microchip also sells compilers for the high-end PICs (“C18” for the 18F series and “C30” for the dsPICs). They also make available for download a “student edition/demo” version of C18 or C30 which disables some optimiser features after a timeout period. Open-source compilers for the C, Pascal, JAL, and for the Forth programming language, PicForth, have also been released.

GPUTILS is an Open Source collection of tools, distributed under the GNU General Public License. GPUTILS includes an assembler and linker and works on Linux, Mac OS X, OS/2 and Microsoft Windows. GPSIM is an Open Source simulator for the PIC microcontrollers featuring hardware modules that simulate specific devices that might be connected to them, like LCDs.

Devices called “programmers” are traditionally used to get program code into the target PIC. Most PICs that Microchip sells nowadays have ICSP (In Circuit Serial Programming) and/or LVP (Low Voltage Programming) capabilities, allowing the PIC to be programmed while it is sitting in the target circuit. ICSP programming is performed using the RB6 and RB7 pins for clock and data, while a high voltage (12V) is present on the Vpp/MCLR pin. Low voltage programming allows for the elimination of the extra voltage rail in the programmer but comes at the cost of an IO pin and can therefore be disabled (once disabled it can only be re-enabled using high voltage programming). There are many programmers for PIC microcontrollers, ranging from the extremely simple designs that rely on the communications software for taking care of all the communication details to complex designs that can verify the device at several supply voltages and can do much of the work in the hardware. Many of these complex programmers use a pre-programmed PIC themselves to send the programming commands to the PIC that is to be programmed.

Many of the higher end flash based PICs can also write to their own program memory. Demo boards are available with a small bootloader factory programmed that can be used to load user programs over an interface such as RS-232 or USB.

There are many programmers/debuggers available directly from Microchip:

  • PICStart Plus (RS232 serial interface)
  • Promate II (RS232 serial interface)
  • MPLAB PM3 (RS232 serial and USB interface)
  • ICD2 (RS232 serial and USB interface)
  • PICKit 1 (USB interface)
  • PICKit 2 (USB interface)


MPLAB (which is a free download) includes a software emulator for PICs. However software emulation of a microcontroller will always suffer from limited simulation of the devices interactions with its target circuit.

The MPLAB ICD2 (RS-232 serial and USB interface). Offers fairly cheap (about £100) in circuit debugging. A programming/debug connector (the ICD2 has a RJ12 socket and comes with a cross wired RJ12 lead but there is nothing preventing the use of custom cables to other connector types) is designed into the target circuit. This cheap and simple debugging system comes at a price however, namely limited breakpoint count (1 on older pics 3 on newer PICs), loss of some IO (with the exception of some surface mount 44 pin PICs which have dedicated lines for debugging) and loss of some features of the chip. For small PICs where the loss of IO caused by this method would be unacceptable special headers are made which are fitted with PICs that have extra pins specifically for debugging. Some third party debugging solutions also exist using the on chip facilities provided for the ICD2.

Finally microchip offers two full in circuit emulators. The MPLAB ICE2000 (parallel interface, a USB converter is available) and the newer MPLAB ICE4000 (USB interface). There are also third party emulators from such companies as RF Solutions, who produce the ICEPIC3 system, these are often lower cost solutions.

Word size

The word size of PICs is a source of much confusion. All PICs (except dsPICs and PIC24s) handle data in 8-bit chunks, so they should be called 8-bit microcontrollers. But unlike most CPUs, PICs use Harvard architecture, so the size of an instruction can be different from the size of the data. In fact, different PIC families use different instruction sizes, which makes it a challenge to compare the code size of PICs to other microcontrollers. For example, say a microcontroller has 6144 bytes of program memory. For a 12-bit PIC, this works out to 4096 words (or assembly instructions); for a 16-bit PIC, this is 3072 words.

Modern PICs

The old PROM and EPROM PICs are now gradually replaced by chips with Flash memory. Likewise the original 12-bit instruction set of the PIC1650 and its direct descendants has been superseded by 14-bit and 16-bit instruction sets. Microchip still sells OTP (one-time-programmable, or PROM) and UV-eraseable (EPROM) versions of most of its PICs for legacy support, or volume orders. It should be noted that the Microchip website lists PICs that are not electrically erasable as OTP despite the fact that UV erasable windowed versions of these chips can be ordered.


Current PICs offer a wide range of built-in hardware, such as:

  • 8/16 bit Modified Harvard Architecture CPU cores
  • Flash and ROM Memory options in 256 byte to 256 kilobyte array sizes
  • I/O Ports (0 to 5.5 volts Typical)
  • 8/16 Bit Timers
  • Nanowatt Technology for Power Moding
  • Synchronous/Asynchronous Serial Peripherals USART, AUSART, EUSARTs
  • Analog-to-digital converters, 10/12 bit
  • Voltage Comparators
  • Capture/Compare/PWM modules
  • LCD Drivers
  • MSSP Peripheral for I²C and SPI Communications
  • Internal EEPROM Memory – up to 1M erase/write cycles durability
  • Motor Control Peripherals
  • USB interfacing support
  • Ethernet controller support
  • CAN controller support
  • LIN controller support
  • IrDA controller support
  • Integrated analog RF front ends (PIC16F639, and rfPIC)
  • KEELOQ Rolling code encryption peripheral (encode/decode)
  • DSP digital signal processing capabilities (dsPIC)


PICs on the Internet

PICs are well-documented on the Internet, mainly for two reasons. First, PICs were commonly used to defeat the security system of popular consumer products (pay-TV, PlayStation), which attracted the attention of crackers. Second, the now obsolete PIC16C84 was the first widely available microcontroller that could easily be re-programmed by hobbyists. There are many forums and lists concerning PIC microcontrollers where the user can post questions and receive free answers.

PIC clones

Every now and then there are companies that offer cheap and/or enhanced PIC versions. Most seem to disappear quite soon. Ubicom (formerly Scenix) seems to avoid this fate and produces the SX, a PIC clone that runs much faster than the original (as of November 2005 Parallax is the exclusive supplier of the SX). OpenCores has a pic16f84 core written in Verilog.

Wireless PICs

The rfPIC microcontroller devices integrate the power of Microchip´s PICmicro devices with UHF wireless communication capabilities for low power RF applications. The devices offer small package outline and low external component count to fit the most space-constrained applications.

dsPICs (Digital Signal PICs)

dsPICs are Microchip’s newest family, which entered mass production in late 2004. They are designed as a PIC with digital signal processing capabilities. These are Microchip’s first inherent 16-bit (data) microcontrollers. They build on the PICs existing strengths by offering hardware MAC (multiply-accumulate), barrel shifting, bit reversal, (16×16)-bit multiplication and other digital signal processing operations.

8/16-bit PIC microcontroller product families

These links take you to product selection matrices at the manufacturer’s site.

8-bit Microcontrollers

  • PIC10
  • PIC12
  • PIC14
  • PIC16
  • PIC17
  • PIC18

16-bit Microcontrollers

  • PIC24

16-bit Digital Signal Controllers

  • dsPIC30
  • dsPIC33F

The F in a name generally indicates the PICmicro uses flash memory and can be erased electronically. A C generally means it can only be erased by exposing the die to ultraviolet light (which is only possible if a windowed package style is used).

External links

For more information visit

Linux PIC Programmer Software

PICPrg A fast Linux command line (or ncurses) program, to program any Microchip PIC using the PC parallel port interface. Program/verify PIC data, erase non-protected/protected PIC data or calculate the PIC checksum.


Lithium Polymer Batteries

Lithium Polymer (commonly called Li-Poly)
Lithium Polymer (commonly called Li-Poly)

Lithium Polymer (commonly called Li-Poly) are one of the latest developments in rechargeable battery technology, these new cells are a great advancement in technology from the older Nickel cadmium cells (referred to as NiCd) and nickel metal hydride cells (NiMH).

Li-poly cells are slightly different from there predecessors in the fact that they provide a average of 3.7 Volts compared to the 1.2 Volts of NiCd and NiMH cells. Additionally they also provide a greater power to weight ratio, it’s now normal to see from a Li-Poly a few hundred mA from a cell that only weighs a few grams.

Li-Poly cells require slightly more attention to both the charging circuit and also a monitoring circuit whilst being used. Thus they have to be protected from overcharge by limiting the applied voltage to no more than 4.235 V per cell. During discharge on load, the load has to be removed as soon as the voltage drops to around 3.0 V per cell, if the cell is continued to be used below the 3 volts then you will find that the cell will no longer accept a charge resulting in a cell that is of no use to anyone and can only be chucked into the bin (recycled).

Among the advantages of Li-poly cells one of it unique features is that there is no metal disks in the cells unlike others this enable the cell to be virtually any shape desired. This means that for the mobile phone and laptop market these cell are ideal. Due to this usage of the cell in such markets as the telecommunication, it has meant the mass production of cells and hence the price of the cells is constantly dropping.

Lithium Polymer Suppliers and manufactures:


Kokam possesses its own unique, proprietary technology (the Superior Lithium Polymer Battery or SLPB), which has proven marketability over existing and perceived competition. Substantial opportunities exist to tap into the market of cellular phone manufacturers and distributors who seek better lithium-ion batteries than those readily available on the market. The challenge is to bring cost-efficiency to the major channel members and OEMs, and Kokam has met this challenge. As more and more of the world’s population have gained an interest in these products (as well as notebook computers and similar portable devices), the demand for lithium-ion batteries has also increased and will continue to increase over the next five years. Kokam’s particular patented design employing the next generation lithium-ion/polymer technology, will increasingly occupy more and more of the total rechargeable battery sales in this industry. Based on its advanced technology and price competitiveness, Kokam’s market share will be extended as fast as it is able to increase production capacity. The cellular phone industry represents very strong demand for this next generation technology, which far exceeds the overall industry’s production capacity. Additionally, the size of market for notebook pc and PDA is being increased fast will be a great opportunity for Kokam. Kokam makes high standard and reliable re-chargeable Lithium battery and its processing equipments and also develop new advanced technologies for future.



SANYO has developed a lithium polymer battery that is ultra-thin (under 4mm) & ultra-light with superior performance, SANYO reliability, and new technology developed in our labs. Lithium polymer batteries employ a new gel-type electrolyte to provide power to the most demanding application in the hand-held world. Once again, SANYO has developed the answer to the demand for ultra-thin, ultra-light, high-power applications.


Lithium Polymer Batteries from PowerStream. Battery chargers, power supplies, dc to dc converters, custom, semi-custom and off-the-shelf