Apple //e

Besides some yellowing of the casing, I acquired a well-loved 1984 Apple //e in good cosmetic condition. This set belongs to a member of Retro Computing SG, which he kindly donated to me.
The set comes with a monitor and the main computer unit, cables, and cover. The power supply was not working and will need some fixing or replacement. The disk drive and floppy disk is not currently with the unit but will be available in the future. (due to travel restrictions)

This Computer brings back fond memories, First used the Apple //e as a 13-year boy in school, The Computer was newly installed, and I begged my teacher to let me join the computer club. Won some programming contests with it and is one of the factors that aspires as a programmer. (the other is the ZX spectrum)

The inside of the Computer unit looks good but will need some cleaning.

Internal parts in its original condition.

I did a quick inspection of the Power Supply Unit hoping for a quick and simple fix, but sadly It will need more work; I will replace it with a modern and more efficient switching power supply. (Unit has already been recapped by the original owner.)

Slots are populated with a Disk controller, Printer card, 64KB 80column card, Z80 CP/M card and an unknown card with a speaker.

Read More

Building a ZX Spectrum Clone in 2021 – Populating the board.

Acknowledgements – ZX sizif 512K Project – all credits to Eugene Lozovoy.

After receiving most of the parts, I started populating the board; I applied solder paste for the SMD parts using the stencil that came together with the PCBs, baked it in the reflow oven, and handed soldered SMD parts on the bottom side with hot air.

The power circuitry is populated on the board next to test the (ULA) CPLD, the most crucial part of this board. Sadly the primary regulator was missing from my package, and I have to reorder it from China. To continue testing, I inserted 5v from my bench power supply to realise I had the polarity reversed; after accessing the damages, the CPLD and buffers were all dead.

I don’t have another CPLD on hand, so I have to wait for the next shipment.

The CPLD and Regulator came in the mail about two weeks later, and I was able to populate and test them, the bare circuit works, and I was able to detect and program the CPLD on the JTAG chain.

The rest of the parts go onto the board except the PS2 keyboard interface, which I have no intention of using. All main ICs are mounted on sockets, as I am unsure if the 2nd hand chips work.

I programmed the Flash ROM next without any incident.

I worked through the night to get everything up on a Friday evening as I was excited.

The video encoder needs some tuning; after I plugged in everything, I managed only to get a stable black border and white screen, it looks like the CPU, RAM, or ROM is not working.

magenta screen

The next thing regarding the CPU is to check the clock lines; no clock means no execution. Indeed, the CPU is not receiving a clock signal; tracing upstream to the 28 Mhz oscillator, it was not running.

Somehow one of the transistors broke and rendered a magenta screen. I replaced it, and the screen colour went back to normal.

The 28Mhz Crystal I bought from China doesn’t have any specifications, so I must guess some of the values to make it work.

The circuit that feeds the clock line is a typical pierce oscillator circuit, so my guess is there is too little gain to start a feedback loop; replacing the 1M resistor with 820K started the oscillator running.

garbled screen

Starting the clock didn’t fix everything; now, I get a garbled screen on boot. However, I now know the CPU and ROM is working, as the diagnostic code in the ROM chip runs without any issues. So the fault should be the RAM.

I suspected that it could be a solder bridge on the CPLD connecting to the RAM; I reinspected the board repeatedly to no avail.

At 4 am, I am exhausted; I took a break and took another look at the problem I am facing; the following strategy is to check all signals from the CPLD. I removed the CPU, RAM and ROM, and wrote a new VHDL code to send a 1Khz signal to all pins.

Slowly tracing the pins one by one, I found “WR” on the system bus shorted to the ground; it all makes sense now why the ROM would run, but the RAM is garbled; the ROM doesn’t use the “WR” bus. The culprit was traced to the area next to the write enable header; I placed the Regulator ground tab out of the line, shorting the WR bus through a break in the solder mask to the ground. I cut the PCB trace to disable the header pin as I do not want to remove and resolder the regulator.

The familiar copyright screen was a welcome sight after removing the short. I was really excited but tired too; time to catch some zzzzzs.

link to part 1

link to part 2

Read More

Building a ZX Spectrum Clone in 2021 – Sourcing for parts

Acknowledgements – ZX sizif 512K Project – all credits to Eugene Lozovoy.

sizif 512K PCB from JLCPCB

The first order is to get the PCB made; the Gerber files are readily available on GitHub; make sure you choose the latest version (rev.D1). I used JLCPCB to manufacture the PCB as I am familiar with them. The boards came in under a week.

Sourcing for components isn’t that easy; with the rising cost of chips, an EPM1270 costs SGD$70, and the video encoder about SGD$25 on major online electronics distributors. To keep the cost low, almost everything I ordered was from China auction sites (Taobao); the problem with these sites is that there is a risk the chips are a dud, remarked or a total fake.

In total, based on the BOM, I ordered all the parts from 20 plus vendors; 3 or more pieces for ICs from different vendors if available.

A box full of components
No photo description available.
duds from China

  • CPU – Z84C0020PEC – these are all used at about $3 each, modern version for the Z80A, likely remarked from old Z80As. Out of 3 pieces, 1 is a dud; the other two work fine.
  • RAM – AS6C4008-55PCN – used static RAM for about $4 each, ordered 5, 2 not working.
  • ROM – SST39F040 – used Flash ROM for about $2 a piece, ordered 3 pieces all working.
  • Sound Chip – AY-3-8910 – These are hard to source in China, ordered three pieces, all dead. I still cannot find a good source for it.
  • Video Encoder – AD724 – These are still in production; I got them as new chips, no issues with them.
  • ULA – EMP1270 – These are new parts; most sellers won’t ship without you committing to a minimum order, I need some back and forth with sellers to get it.

Connectors and switches are a hit and miss; you buy them by looking at the picture of the item, which some might be misleading; most of them fit, but they gave me a short tactile switch instead of the long one.

The rest of the parts are ok, except the 28Mhz crystal; it is sold without specifications that cause issues during the build.

The keyboard connectors are from Digikey; it would be tough to get them from China. It might be cheaper to get it from the regular UK retro parts vendors.

link to part 1

link to part 3

Read More

Building a ZX Spectrum Clone in 2021 – Begining.

ZX Spectrum – Recreated casing from ZX Renew.

The ZX Spectrum started me down the path as a maker in the 80’s, it was my first computer, and I had so much fun and learning with it. I always wanted to build a spectrum clone when I was young, but I don’t have the skills and resources.

Originally I wanted to make a retropie emulator but was quite turned off with the long loading time and navigation. So my idea was to have it much closer to the original experience with the machine when I was young.

While researching for a better Spectrum emulator, I stumbled on a RasPi bare metal emulator, the “ZXBaremulator” it boots at without going into the Linux screens. I have an old RasPi 1 Model B to hack with, and without thinking much, I ordered a recreated casing, keyboard membrane and faceplate from ZX Renew and waited patiently for it. I was disappointed when It came two weeks later in the mail; I did not order the rubber mat (I thought it was a mouse pad or something). So I placed another order for the mat (paid another £15 for shipping)

A complete set of the casing with RasPi.

Another two weeks passed, and I finally got the recreated case and started hacking the RasPi to fit the case.

Everything works fine except for one crucial part that doesn’t work for me; I cannot load tape the slow and regular way; that takes away the ’80s experience.

So I started looking for other solutions, and I decided to design and build a clone from scratch.

As part of my research, I ordered the book that everyone recommends for building a spectrum clone, “The ZX Spectrum ULA” by Chris Smith; it is a very well-written and informative book. I spent many nights reading and pondering my approach to building a Spectrum clone.

While researching, I found several open-source ZX Spectrum projects, like the Harlequin 48K / 128K, ZX Uno, and many more. And of course, I lust over the Spectrum Next, hoping to support the 3rd issue in the future if there is one.
In the end, I decided not the reinvent the wheel and pick a project to work on; I chose the “sizif 512K” as it is the closest to what I wanted and more. I wanted a clone that uses as many real parts as possible, especially a real Z80. The only problem I have is there is little guidance in building this clone; I will have to spend some time figuring everything out and sourcing for parts.

link to part 2

Read More

ESP8266 – Ikea Molgan light Hack – added retries to prevent battery drain.

I was on holiday over the weekend and the unit works like a charm, I was notified of all activities detected by the PIR set above my main door.

With wifi_station_set_auto_connect(TRUE) the constant tries to connect to a missing AP or wrong password will run the batteries flat in no time.

Default retries is now set to 4 in which after that the ESP8266 will go in deep sleep to conserve power.

Read More

HTTPS and REST protocol.

Programming the ESP8266 to use REST protocol directly is a more practical solution in most case as not everyone have a MQTT broker to work with.

The problem is most notification service now uses SSL for security reason, and the ESP8266 stack can’t seem to work with HTTPS servers.

Did some test with,  on port 80 and a non secure connection, my code works fine. The ESP connected and return a page. On a secure connection, on port 443 it fails on handshake.

I think the current SSL stack in the ESP8266 sdk cannot handle strong encryption, or the certificates might be too big or heavy for it to handle.

It is beyond my skills to get SSL working, I guess I will have to work on another solution.

Read More

ESP8266 – Ikea Molgan light Hack – Software and actual usage.

After hacking the hardware, the next part is programming the firmware.

The basic flow control is simple.

  1. boot
  2. log on wifi
  3. get time from NTP server (
  4. format text with timestamp
  5. log on to MQTT broker
  6. publish formated text to MQTT broker
  7. go into deep sleep.

Full source available on GitHub.

MH6After I have a decently working firmware, it is time to put everything together. I added a capacitor to the power rails to stabilize and eliminate false trigger. I think the sudden power draw by the ESP8266 somehow caused the BISS0001 to reset and kept the light on.


I have to trim off some plastic to fit the everything into a small package.


Looks complete and nice as a package with it’s cover is on.


Everything works almost perfectly but I think it will be more practical to run it off a wall plug, As I can imagine that the battery would last less than 2 weeks in this config, that will limit it’s usefullness.


I set up mqttwarn to push notification to my phone and computer (pushbullet) whenever motion is detected by the PIR.


Read More

ESP8266 – Ikea Molgan light Hack – Hardware.

The first ESP8266 project I worked on is a wifi PIR detector.


My original plan was to use an cheap Ebay PIR and 3D printed case for this project but I happen to have a spare Ikea Molgan PIR light lying around, I opened it up and take a peek inside and decided to work this hack with it, overall this is an attractive and cheap unit. (SGD$9.90)


Removing the top dome was easy as it is friction fitted and held together with some tape, upon closer examination, it uses the same parts as most cheap Ebay PIR, just with a bigger dome lens, LEDs and battery holder. Running on 3 x AAA battery , voltage wise it is pretty ideal but I don’t think it will last too long once I hook the ESP8266 to it.

CDs and PIR in the Middle surrounded by 5 ultra bright LEDs

On the topside after removing the plastic dome, you see the PIR and LEDs, at the side is a light sensitive photo-diode that lowers it’s resistance in the dark, arming the PIR.

I removed the photo diode so the unit will work in daylight.



On the back of the PCB, the circuit is very similar to cheap Ebay PIR, with the same control chip, BISS0001 and RC circuits to control trigger pulse and re-arming timing. Voltage regulator is a 3V, 30mA LDO – HT7130, not enough for the ESP8266 as it draw about 250mA with it’s radio on.


Next I removed 3 out of 5 470R current limiting resistors, disabling the LEDs. Out of the remaining 2 LEDs,  1 is for visual feedback and 1 for the opto-coupler. I replaced the 470R at the end of the project with a 1K to dim the light and lower the power consumption. Resistor R10 (pulse length) is changed to 100K from 1M to shorten the pulse, we only need enough time for the ESP8266 to power up get an IP, SNTP time and publish a MQTT message.


An opto-coupler was used in place of an LED to solve the voltage difference between the light and ESP8266. The voltage supplied to the LED is 4.5V and the chip runs on 3v, voltage at the output pin to the base of the switching transistor is only 1.8v.


A simple LDO is used to convert the 4.5v to 3.3v and the rest is hooked up based on this schematic. The pin CH_PD is pulled high when the PIR is triggered, booting the ESP8266. One abnormal behaviour with this light is that it will stay triggered if the ESP8266 radio is on,  the solution is to put it into deep sleep with the radio off after the message is sent.



Software and actual usage. 

Read More

ESP8266 – Native SDK.

nodemcu is a wonderful piece of code but it don’t work well on my ESP-01, it will go into a boot loop with just a few lines of code. Initially I though it was my mistake but it does that even with published examples.

Moving on, I took a bit of time to set up esp-open-sdk and started to work on what I think will be a base for my future ESP8266 projectts.

My basic code is based on tuanpm’s native mqtt library and stdout which reclaims the RX pin for use as GPIO3.

blink1The code basically logs on to my wifi AP then to the MQTT broker (mosquitto) on my server. By default, I can control a LED connected to GPIO2 by publishing a 1 or 0 to the topic subscribed by the ESP-01 and read a switch on GPIO0. RX/GPIO3 can be configure for other use.

Code available on my Github repository.


Read More

ESP8266 – $3.08 Wifi MCU


Measuring 25mm x 15mm, this tiny board pack quite a punch in terms of features. Made by espressif, this device have become very popular with engineers and hobbyist all over the world.

There are many varieties of the ESP8266, I bought the cheapest of the lot for only $3.08 each from ebay with free shipping.

Received the ESP-01 after about 2 weeks wait and I eagerly tested it by loading nodemcu on to it and runing the code below, it logged on to my AP with ease.

    ip = wifi.sta.getip()
    ip = wifi.sta.getip()


Read More