Monthly Archives: July 2014

There’s life in the old dog yet…Part 3

After a bit of reading around the subject it appears the majority of Amiga video problems are either related to issues with the RAM or the Agnus (Address Generator) chip. The RAM chips are all soldered directly into the board so I re-soldered all of those and still the same issue.

Then I remembered when I first got my brand new Amiga back in the day the first time I plugged it in I had a similar issue. I phoned the computer shop where I had bought it and they said “Its most likely because one of the chips is not seated correctly in its socket. Unplug every thing and hold it flat about two inches above a soft surface (like carpet) and then drop it”. You can imagine my horror. But they assured my if it didn’t work they would replace it with no issues. Much to my relief at the time it worked.

The Agnus chip sits in a 84 pin PLCC socket so I removed Agnus from her socket and set to work re-soldering all of the pins. I reseated Agnus and put everything back into the case before reapplying the power. Much to my relief it appeared to work and since the floppy emulator was still connected it booted straight to the Amiga Pi Drive front end.

Using Maurizios Amiga Pi Drive emulator couldn’t be simpler. The front screen shows a list of all of the ADF (Amiga Disk File) and ADZ (compressed ADF) files found on the SD card. Four floppy drives are shown on the right. The interface only supports drives 0 and 1 (SE0 and SEL1 lines from the motherboard). Drive one may be disabled if you wish to fit a real drive.

Amiga Pi DriveEach drive can be loaded with a number of ADF or ADZ files. The first file in each drive drive will be loaded when emulation is started. For all intents and purposes the Amiga sees a real floppy in this drive and begins to boot it. Pressing the “Change” button loads the next file in the list into the drive. If changes are made on that drive pressing the “Write” will write the contents back to the file on the SD card.

Imgp0746The internet is rife with Amiga emulation sites so finding all my favourite games wasn’t difficult. I downloaded a few I put them on the SD card. Then it was just a case of reminiscing those good old 16 bit classics. I must admit though playing games on my old Cruiser joystick felt a bit alien after playing with modern console controllers. Still the playability of the old Amiga games still win hands down in my opinion.



There’s life in the old dog yet…Part 2

Stop the press. After going down the avenue of replacing the internal floppy drive for a few days (found a couple on eBay but who’s to say these aren’t going to fail in the near future after all these things are over 20 years old) it dawned on me there must be a more up to date solution.

I know some of the later Amiga models the 600 and 1200 featured a 44 pin ATA connector allowing for a 2.5″ internal hard drive to be fitted. And with a suitable connector this hard drive may swapped out for a compact flash (CF) card or I believe even an SD card with the correct hardware upgrade. Unfortunately this is not an option on the old Amiga 500.

The only option appears to be a floppy drive emulator something like Lotharek’s Floppy Drive Emulator. Which allows you to load Amiga Disk Files (ADF) from an SD card or USB mass storage device. Again these are pricey with Lothareks emulator retailing at around 70 euros!!!

So I was toying with the idea of purchasing a second hand drive from eBay when I stumbled upon a floppy emulator a guy (Maurizio Ramondo) had designed for his Amiga 500 using a Raspberry Pi. Like a lot of people I bought a Raspberry Pi when it was first launched. Up until now all its been doing is running Xbox Media Center under my TV.

InterfaceThe Amiga RPI Drive connects GPIO lines from the Raspberry Pi to the Amiga floppy connector via an interface board which takes care of all of the level shifting. The floppy drive I/O being 5V and the Raspberry Pi GPIO being 3.3V. I redrew Maurizios original schematic just for my own benefit. I wanted to have a 26 pin socket so I could connect a ribbon cable from the Raspberry Pi directly to the interface.

The circuit is fairly simple. Each input line is pulled high and then passes through a voltage divider to bring the level down to a more reasonable 3.3V for the Pi. The outputs from the Pi go through a 74LS06 open collector output inverting buffer allowing the signals from the Pi to be pulled up to 5V by the Amiga. The 5V supply voltage is supplied from the floppy drive power connector on the Amiga motherboard. The RDY line is managed directly by the interface and is used to help protect the bus when there are external drives disabling the CHNG line and the DKRD line. The remaining lines are all under software control. The interface only supports two drives since only the SEL0 and SEL1 lines are brought out on the floppy connector. The second line, SEL1 can be disabled via a switch allowing a real external floppy drive to be connected. Maurizio recommends that a Raspberry Pi Model A is used since the Amiga is only able to supply approxitaely 550 mA whereas the Model B he claims draws around 700 mA under certain conditions.

Img_3435Because of the strict timing required to emulate Modified Frequency Modulation (MFM) used by the Amiga floppy drive Maurizio does not use the Linux kernel. Everything was written from scratch. I wont go into any more detail if you want to know more then I suggest you visit his website. Maurizio even provides an SD card containing the kernel and all the files required to boot the Raspery Pi. The SD card even includes a copy Xcopy III allowing you to rip your own disks as well.

The more observant are probably thinking there seems to be a distinct lack of connections. The remaining interconnections are all made underneath the board so the rats nest of wires is hidden from view.

Using the emulator is fairly straight forward too. On power up the emulators front end is loaded. This allows you to queue any number of ADF files into a specific drive. The user then selects the play button and the first disk in drive 0 is loaded. The interface has two switches “change” and “write”. The change switch swaps to the next the disk in the drive. The “write” switch writes any modified disk contents back to the the ADF file on the SD card.

Img_3441After removing the internal floppy drive I was originally going to extend the internal floppy drive and power cable out of the side of the Amiga where the floppy disk slot is. Hence the reason for all of the switches being fitted to the strip board. But after removing the drive it seem to make more sense (space permitting) to mount both the interface board and the Raspberry Pi in place of the original floppy drive. To my surprise it all fitted. I did have to remove the shielding  over the motherboard so I am hoping I don’t have and EMI issues. I then mounted two more push buttons for the “Change” and “Write” functions and a toggle switch for disabling the second drive and fed the connections back to the interface board.

With the interface board completed, the kernel copied to an SD card and everything fitted into the Amiga case I powered everything up. The Pi appeared to power up fine however now all I get on the display is a green screen. Well its too late now so this is going to have to wait for another day. No one said working with these retro machines was going to be easy.


Variable Electronic Load

I often find myself needing a constant current load when testing power supplies, high power LEDs etc. I have thought about building my own for a while now ever since seeing the one Dave Jones built on his EEVblog way back in 2010.

My goal was to design an electronic load capable of sinking a reasonable amount of current, portable so it could be moved around with ease, microprocessor controlled, support constant current, constant power and constant resistance modes. As well as not costing the earth to build.

The design I came up with is relatively simple. Almost all of the component choices are based on what I had lying around. I wasn’t sure at the time how I was going to drive the electronic load so tried to make it generic hence the external ADC and DAC. This way any micro controller with SPI could be used.

Electronic LoadThe main current path for the load is through the MOSFET Q1 and the sense resistor Rsense. The amount of current flowing through the load is controlled by adjusting the voltage applied to the gate of Q1. Opamp IC5B is configured as a voltage follower. When a voltage is applied to the non inverting input the opamp will drive Q1s gate voltage to ensure the voltage applied across Rsense is the same as the voltage appearing on the opamps inverting input pin. So applying 1V to the input results in 1V being applied across the sense resistor meaning 10A (1V/0.1R) will be flowing through the load. R11 and C9 provide stability to stop the output from oscillating.

The load current is set by the output of the DAC. I choose the MCP4921 because it has an external reference input. Using an external 2.5V reference and a small trim pot the DAC reference voltage could be adjusted anywhere between 0 and 2.5V. Meaning the maximum load current could be adjusted while still maintaining the resolution. The DAC output voltage is divided by 2 (although looking at the schematic its appears to be divided by 5) before passing through the voltage follower IC5A. Allowing for a maximum load current of around 12.5A.

The load voltage is divided by 9 before passing through the voltage follower IC5D and is then applied the first ADC channel. The ADC has a reference voltage of 4.096V which allows for a maximum load voltage of approximately 36V. I choose to use a MCP3008 ADCs mainly because I had a few lying around. Bit overkill since I only needed 2 channels but the unused channels were simply tied to 0V.

The load current is determined by measuring the voltage across the sense resistor. This voltage is amplified by IC5C and is then applied to the second ADC channel. With a load current of 10A this results in a voltage of around 3.8V.

The FET I choose was a BTS141 smart low side power switch. I could have gone with some other logic level FET or BJT but decided to go with the BTS141 since is has ESD, overload, short circuit and over voltage protection as well as thermal shut-down. I must admit I was a bit paranoid about the FET burning up and figured the extra protection was worth the extra cost.

The next step was to choose a suitable heat sink. The maximum operating temperature of the BTS141 is 150 degrees Celsius. The heat sink I choose to use has a thermal resistance of 2.33 C/W. According to the BTS141 datasheet it has a junction-case thermal resistance of 0.84 C/W. Ignoring the case to heat sink thermal resistance this gives a total thermal resistance of 3.17 C/W. Assuming an ambient temperature of 25 C means the maximum power dissipation would be (150-25)/3.17 = 39W.

I decided to start building the circuit on breadboard so I could get something up and running as fast a possible. To control the everything I used an Arduino Nano (technically its a copy but hey) with a 4×20 LCD dot matrix display and a few external push buttons.

Electronic LoadThe code in the Nano is all written in C. I like the idea of the Arduinos and the relative ease that you can have things up and running but using the Arduino development environment just doesn’t offer the flexibility I want. The Arduinos are a great way of getting a cheap AVR development board and since they all have external ICSP pins you can even erase the bootloader and make use of the entire flash memory.

The software at the moment only supports limited functionality. Which was just so I could test the hardware and calibrate the inputs and outputs. You can see from the picture the circuit working with a load current of a 1.25A @ approx 8V. I have had it running with 10A @ 3V with no issues. The heatsink gets a bit hot but that’s to be expected.

The next stage is to get the final circuit built up and into an enclosure and then finish off the software.

There’s life in the old dog yet

After a recent trip to my parents house and being gently persuaded to take all my old “junk” with me I found my trusty old Amiga tucked away in the loft complete with old boxes of disks. The case had severely yellowed which seems very common with these old computers.


Back in the day I spent my formative teenage years virtually glued to the keyboard of this thing. After the initial infatuation with playing games had worn off I taught myself 68000 assembler and started writing utilities and demos which I guess with the exception of writing a bit of BASIC on my old Amstrad CPC 464 was my first real venture into programming.

So fast forward 20 plus years would it still work ? The first thing I did was take it apart. Just to check everything was still in one piece and check nothing had been damaged. Now being designed when it was all components are through hole. No surface mount in here. Img_3426The majority of the chips are all socketed with the exception of the memory. Everything looks good a bit of dust but that’s about all. Even the battery on the memory upgrade seems to be good a tiny bit of leakage but not enough to have damaged anything.

Initial power up was fine. The red power LED illuminates and the internal floppy starts clicking. So far so good. After connecting the AV-scart lead to my 40″ Samsung LCD TV no picture. Just a white screen. Not good. In the past I had always used an old 15″ Sony CRT TV/monitor which has long gone now. However after rummaging through the box of peripherals I found the original TV modulator. Feeding the composite video from the modulator to a scart-phono adaptor worked just fine. Few so there doesn’t appear to be anything wrong with the Amigas video output stage.

So how am I going to get a decent (ish) picture on a modern LCD TV ? I guess there are a number of options. A lot of people use scan doubler/flicker fixers. Something like the Indivision ECS scandoubler from Amigakit.

Img_3430This simply slots into the video chip (Denise) socket and runs a 15 pin SUB plug to provide VGA output up to 1024×768. There are also a number of scandoublers on eBay that appear to be based on the CGA/EGA/YUV to VGA converters I used in my Weecade arcade machine. Both these options retail for around £80 which is more than I really wanted to spend just to get an old computer up and running.

After a bit more googling I found an article talking about the signal voltages on the video port. It seems these voltages may be too high for most modern TVs. The SYNC signal from the Amiga is apparently around 4.8V peak-peak. Which makes sense if the Amiga is running 5V TTL throughout. Modern TVs expect a synch signal on the composite video or synch on green with a peak voltage of around 1V peak-peak. Since they would probably be operating at 3.3V/1.8V levels. The composite synch input has a 75R terminator which when coupled with a 330R resistor along with the 47R inside the Amiga gives a SYNC voltage of around 1V peak-peak.

So I connected a 330R resistor between pin 10 of the Amiga video port (TTL synch) and pin 20 of the scart lead (composite video). For each of the colour signals Red, Green and Blue I added a 220uF electrolytic just to block any DC bias on those signals. The AV mode signal (pin 8) on the scart was fed from the 12V signal on the video port via 1K resistor. The RGB mode signal (pin 16) was fed from the 5V signal on the video port via a 75R resistor. The logic grounds (pin 13 video port, pin 18 scart) were connected together. The remaining video grounds on each connector were tied together. The audio signals from the scart to two phono plugs was left untouched. Again a couple of small electrolytic capacitors could have been added but I choose not to bother.

After hooking everything backup and firing up the Amiga the iconic start-up screen appeared in all its glory. First hurdle overcome.

With everything up and running I tried booting from the original workbench disk. After inserting the disk the drive starting making some rather strange noises the AmigaDOS screen appeared but then the disk error dialogue appeared soon after. After trying a hand full of other disks it became clear the drive has had its day.

Time to find a replacement internal floppy drive.


OBD2 Adaptor Teardown

A number of years back a bought one of those cheap bluetooth OBD diagnostic tools from eBay. I cant remember why I bought it now (obviously for use on the car) but I must have only used it a couple of times. Having found in my desk drawer at work last week I decided to take it apart and have a look inside. From what I recall I only paid around £10 for it so was quite intrigued to see what you get for your money.

The device has “ELM327” written on the top of it. For those who don’t know the ELM327 is a programmed micro controller produced by ELM Electronics for translating messages from a vehicles on-board diagnostics (OBD) interface. According to Wikipedia the ELM327 is implemented on a PIC18F2480 micro controller from Microchip. Vehicles that support OBD communicate over one of a number of protocols. For older vehicles this tends to be either ISO 9141-2, ISO 14230-4 KWP or J1850 pulse width and variable pulse width modulation. Modern cars tend to use the controller area network (CAN) protocol. The ELM327 supports all of these protocols.

Further research reveals that ELM failed to implement any code protection on the original ELM327 chips. These chips were then cloned and form the basis for the majority of the cheap Chinese imports you now find on eBay. The version number in the firmware of these clones also appears to have been modified to report versions newer than the original release even though the functionality remains the same. Most of the adaptors currently on eBay claim to be v1.5. I have been unable to find any reference to a v1.5 on the ELM website.

OBD2 Device

Here is a picture of the PCB after it was removed from the case. The OBD connector which is connected via a 16 pin ribbon cable to the pin header has also been removed. The soldering looks good. All the components appear to be fitted correctly. We can see the main micro controller is indeed a PIC18F2480 the same processor ELM use for their ELM327. No labelling here so its more than likely the PIC18F2480 has been flashed with the ripped off firmware.

Now comparing this PCB with suggested example circuit diagram on the ELM327 datasheet. It quickly becomes clear this example has been adopted with some minor modifications. An off the shelf Bluetooth module (middle right) has been added. The RS232 level shifting has been removed since the TX & RX lines on the PIC connect straight through to pins on the Bluetooth module. I haven’t gone over the board component by component but you can clearly see in addition to the main micro controller, the MCP2551 CAN transceiver, the 78M05 5V regulator (bottom right) used in place of a 78L05 on the schematic. The 1.5A 50V rectifier diode in line with the battery voltage for reverse polarity protection. The LM317 adjustable regulator used to control the J1850 bus voltage. There appears to be additional filtering on the board as well.

ELM327 Datasheet

The bluetooth module looks like the e-Gizmo EGBT-046S. Versions on eBay appear to be known as the HC-05 or HC-06. The difference being the HC-05 can be configured as a master whereas the HC-06 cannot apparently. The main chip on these boards is a CSR BC417143 BlueCore® 4-External single-chip radio and baseband IC. Below it is the 8Mbit of external flash containing the firmware.

After applying power to the header and successfully pairing it with my PC I was able to communicate with it using puTTY. The ELM327 AT commands list contains a list of all of the commands supported by the device. Now obviously I couldn’t issue commands to poll vehicle information but I can send AT commands to perform simple tasks such as reset the device or report the firmware version number.

I reset the device by sending an “ATZ” command to which the device responded with “ELM327 v1.4”. Interesting. Sending the command “AT@1” returned “OBD2 to RS232 Interpreter”. This seems to be valid. However sending the command “AT@2”, which is only supported in firmware versions v1.2 and greater, should display the device identifier. The device returned no response. This indicates to me as expected that this device must be one of the cloned originals.

Still putting this into perspective. The original ELM327 chips from ELM Electronics are priced at $18 and that’s just for the IC. Add in the additional cost of the CAN transceiver, the extra components, the PCB and a case and you could not even build one yourself for less than what I paid for it. And besides it works!


Dave Jones Microchip PICkit 3 Review

I love Dave Jones and his no prisoners approach to video blogging. For those who haven’t seen his electronics blog EEVblog be sure to check it out. One video that did slip through my net was a review Dave did back in 2009 of the new (at the time) Microchip PICkit 3. Dave was shall we say less than enthusiastic about it. You’ll see what I mean when you watch the video.

But what followed in the days after is magic. Microchip responded with their very own video.

It is really refreshing that a company the size of Microchip not only addresses the concerns of individual users (all be it users with some influence) but also has a sense of humour about it.