The beginning…

A couple of weeks back I started designing my own CPU (called Bizzas CPU) in Quartus II with the initial goal of getting it running on an FPGA. Right now im bouncing between many different tasks as well as trying to just chillax from time to time.

Elements of a CPU such as registers, program counters and ALU‘s are pretty easy to design. I have most of that done. My current task is to design a robust and efficient instruction decoder, or instruction executor as I call it. After that, I will make an instruction loader.

Once those are done, the CPU will hopefully be ready to run inside the FPGA without any significant connections to the outside world. Then the next step is to wire it up to some memory and other peripherals, maybe even make a VGA interface.

End goal is ofcourse world domination!

Here is what a 1-bit ALU block looks like inside:


This particular configuration can do add, subtract, XOR, AND and OR. Not bad for only 7 logic gates.

My project is shared in its entirety on GitHub:


Scrap electronics


It wasn’t until just a few days ago that I was informed that the neighbourhood garbage recycling shack had a bin for old electronics. This is spite of telling lots of people that I wanted to get my hands on scrap electronics.

I have been living in this area since before they even started the recycling thing. Im not the one that takes out the garbage (I’m disabled, not lazy).

Right away I grabbed the two DTV boxes = two 80Gig harddrives, the vacuum = 10 AA Ni-MH batteries plus a motor. And I grabbed some coords and power supplies.

Working house monitor

For some time now my house monitor circuit has been working and logging data as well as providing a web interface where the current status of the sensors can be seen. Not that many sensors right now but;

  • Door sensor. Simple aluminium foil pads in the doorframe wired such that if the door is closed, the input pin is directly connected to ground. If the door opens, the connection is broken and through a 5k resistor, the pin is pulled up to +5V.
  • Motion sensor pointed at my hallway and door. To see when people come and go, as well as seeing when I visit the toilet and such… there is no such thing as too much information…
  • Photoresistor underneath my desk lamp. Any time Im at my desk, my desk lamp is lit, so its an indication of wether Im at my desk or not.
  • Dallas 18B20 temperature sensor. Next to my desk (but one shelf up above a server so its constantly reading a bit hotter than the rest of the room).

In the future I hope to expand the system with wires to my window for reading outside temperature and light.

And I have to work on making graphs for trends over the course of a day, month or year for temperature and light sensor readings.


OneWire circuit

So I’m having thoughts of wiring my house with a bunch of sensors but would like to limit the amount of wires as much as possible. Ofcourse that would best be done with some kind of OneWire circuit. One wire for ground and one wire for data and power.

I’ve experimented in Falstad’s circuit emulator and so far this is what I’ve come up with.


The 470uF capacitor keeps the remote circuit (here its just a 1k resistor) powered while the data line (A) is pulled to ground to send signals. The resistor-transistor at the power source limits the current so it won’t short-circuit. The switch will be replaced with a MCU of some sort to control the sending of data.

I’m thinking of CLR, DATA and CLK going into a 74HC164 serial-to-parallel chip. Pulling the data wire (A) to ground very briefly would latch a 1 (one) as CLK goes back high, pulling it to ground a little bit longer would drain the 4.7uF capacitor enough to register a 0 (zero) when CLK goes high and finally pulling the wire to ground long enough to drain the 10uF capacitor would make CLR go low and reset the HC164 (asynchronous active low).

Timing depends on the values of the capacitors. Ofcourse at point (B) the voltage to power the MCU would be only 3V, but an atmega or attiny will run on that. It’s even possible to have several sensor circuits on the same two wires.

Now I just have to go from drawingboard to physical circuit and make it work…

FPGA arrived

Just arrived from China, a small cheap FPGA: Altera Cyclone-II (EP2C5T144).

The device itself is the least capable of all the Cyclone II FPGAs, but its seriously cheap at only $13. And its big enough to hold a basic CPU core. This is what it looks like (9V battery included for scale):


The USB Blaster has to be bought separately but only costs an additional $3. Unfortunatly the DC jack is for 5V, its unregulated unlike Arduinos. Bummer. And I dont have any 5V adapter with a 5.5mm plug so I have to make one myself.

Here are the specs for the board itself (and others of the same family, its the smallest one, EP2C5):


So now Im mostly ready to start designing and testing my own CPU. Ive already started some basic designing since a couple of nights back. Gaining some insights and making early design choices.

I still havent committed to wether the data bus should be 8-bit or 16-bit. Id like to make it 16-bit but that means a whole lot of wires (since its ultimately imagined as a breadboard design). Now that I think of it maybe I should make a first test design with address bus and data bus both being 8-bit.

Sorting integrated circuits

Today I received an order of compartmentalized plastic boxes for sorting things into. And so I sorted what I have so far. Some compartments are empty because the chips are still in my shopping cart at Digikey. And some are in the mail on the way here from China (Aliexpress).

Small compartments but can pack up to 20 chips into one if its just packed well. If thats not enough then the dividers can be removed to expand compartments sideways. The horizontal dividers are fixed. Vertical dividers on the compartment right at the lock mechanism is also fixed. But all in all, a cheap, neat, easy solution for sorting integrated circuits.


Link to the Aliexpress item. Shipping took 19 days from China to Sweden by China post registered air mail.

BreadLED, again

My second attempt upped the neatness factor a little bit. I also changed the resistor to 2kΩ to dim the led a bit and maybe save a bit of power.

Top one is first attempt, bottom one is second attempt.