Category Archives: Minature Quadrokopter

VHDL when else vs. case is (part 2)

Ok there are two implementations. The implementation basically does a data mapping of 88 random 11 bit wide  indata values to 88, 11 bit wide outdata values. Everything is done combinatorically.

The first implemntation looks like this:

p1: process(indata)
case indata is
when “11100000001” => outdata<=”10000110111″;

when “10000110111” => outdata<=”00001011001″;

…….(86 more mappings)

when others => outdata<=”———–“;
end case;
end process;

And the second one implents the same thing with exactly the same numbers but uses an alternative statement:

outdata <= “10000110111” when indata=”11100000001″ else
“00001011001” when indata=”10000110111″ else

………………(85 more mappings)

“11110110011” when indata=”00001000001″ else


To make the story short, here is the result from Quartus v11.1 :

First implemntation with case is:

Total logic elements : 261 / 33,216 ( < 1 % )


Second implemntation with when else:

Total logic elements : 932 / 33,216 ( 3 % )


Yes thats quite creapy. Thats nearly 4 times as much logic.


VHDL when else vs. case is

I recently i tried to compress some random numbers. 😉  The idea was to use hierarachical state maschine to generate the random looking data from them. To do this i would need to generate the transistion logic of the state maschinne out of the random data. I thought KV-Diagramms or the quine mccluskey algorithm should work since they minimize the logic function.

As i know modern synthesis tools use these technics, so i just thought, why not  put the combinatorical transition logic of some random numbers into a vhdl description and see how many LUT4’s (each 16 bits) it would take.

What i ended up doing was compering and wondering the synthesis result between the VHDL:

when else  statment and the case is statment. (Results in the next blog)

Tracking the rotation of our Earth

Here i show a simple system i built to track the Sun passing the sky. Some people call it Sun tracking, but i dont like it because it suggest that the Sun is moving. Yeah the sun is indeed moving, but it is not what is tracked.

Electrical parts used:

1 x Photoresitor, 1 x Transistor, 1 x Solarpanel, 1 x Operational amplifier, 2x Potentiometers, 1 x Motor with gear


If the Photoresistor is under direkt Sunlight the Motor is switched on. This rotates the complete device. This will move the shadow over the Photoresistor. This switches of the Motor.

Python Hardware Cpu

Running a very small subset of python on an FPGA is now possible.  This Python Hardware CPU (written in an hardware description language) can directly execute a very small subset of python bytecode with one bytecode instruction per Clock cycle.

This is a implementation of a kind of a microprocessor in myhdl which can directly  execute, very limited python bytecode. This myhdl description of the processor can be converted to standard VHDL. Since myhdl is written in python the CPU programm and some additional (if needed) hardware description can be handled in the same file. This simplyfies designing a lot.

I was able to run the Python Hardware CPU on the lattice pico development board. Soon i will create a additional page with more information on that for more information on the CPU visit here.

The approach is to directly execute python bytecode (but without all the dynamic features of python) where nearly every instruction is executed in one Clock cycle.

In the end i was able to successfully run python code which is as complex as the following.


def kate(Cycles,argx):
  while x<Cycles:
  return 2

def delay(Cycles1,Cycles2):
  global PORTC_OUT
  while x<(Cycles1+Cycles2):
  while x<kate(1,global_argument):

def CPU_main():
  global PORTA_IN,PORTB_IN,PORTC_OUT,PORTD_OUT # at least output ports need to be defined as gloabals
  while 1:
    #funcas(kkt(3)) # calling a function with an function as an argument would not work
    if PORTA_IN==1:
    if x<20:
    elif 20<=x<25: #x>=20 and x<25: #both work 

Another interessting approach for example would be to use a standard  microcontroller from opencores or etc.., which can execute c or c++ and than use “Shed Skin” or “Pyrex” or  to convert the python code to c or c++ and then load it into a microcontroller on an FPGA or so. Probably “Shed Skin” makes use of some heavy libraries which would blow up the hole thing. Just an idea.

Miniatur Quadrocopter

Miniatur Quadrocopter

The Copter:

Miniatur Quadrocopter

The PC Side:

The Copter control system:

Simple force Models:

Force model (reduced to one axis):

PCB Layout:

This is a Minatur-Quadrokopter i made for the Master Degree in Embedded System Design at FH-Hagenberg.

Hardware Details:

  • AVR32UC3B1128 (Atemel 32 Bit Microcontroller)
  • At86rf230 (Atmel 802.15.4 Transceiver 2.4 Ghz
  • L3G4200 ( STM Digital 3 Axis Gyroskope)
  • ADXL345 ( Analog Devices Digital 3 Axis Accelerometer)
  • 2 Dual IRF5852 ( MOSFETS  )
  • Single Lithium Polymer Cell 3.7 Volt
  • Self made  PCB Folded Dipole Antenna ( Not Calibrated )
  • 2 Layer PCB, all Parts on the Topside

The Thing in Action:

Flying and filming seems to be tricky 😉