Search This Blog

Wednesday, December 7, 2016

"شيزوفرينيا" ضرورية


يفتح الستار على جسد عار 
وضوء شاحب
هكذا أريد أنا صاحب السرد 
وهكذا يريد الضفدع المشاغب
قاب كأسين أو أدنى
قاب نهدين أو أدنى
سقطت عن حافة العقل البراءة
سقطت من قلبي المتاعب
سخافاتي قبل نومي
في قاع التابوت انقشها
كي لا أرقص للجمهور
رقصة الثعالب
يمشي ظلي القصير دوني
فأنا إن داهمني الحضور
أحسبني عند العد غائب

Sunday, November 6, 2016

على درب الشِّعرَى اليماني Friedrich Dürrenmatt-Siriusbegleiter

ما رأت عيني أقرب منك .. أيكون فصل الختام بك والقادم المكتوب لك اكتمل بريق الماس فيك واحترق المكان ووقتاً أحرقت هذا أنت هنا طريقاً في الفراغ بهولِك شققت حياتك التي أُعطيت، يا صغيرنا أَعطَيت نجماً عجوزا يا لهيبَ الثلج في ليلنا أمسيت أيكون فيك موتنا ام انك من خوفنا اكتفيت



على درب الشِّعرَى اليماني
* قصيدة للشاعر والروائي السويسري، فريدرش دورينمات، ١٩٥٨

Tuesday, August 9, 2016

WE Project: Peltier Temperature Controller


I spent the weekend learning about TEC controllers and Peltier elements and attempted to build a basic Peltier controller. On the electronics side I used a 2 channel buck converter as shown in the simple schematic. For the inductors i used a pair of 230uH coils,  2 x 3A Schottcky diodes and identical pair of n Channel switching MOSFT I found in my inventory.






I used a small Peltier element (7108AC) with these characteristics: -dTmax = 70°C, Qmax=43.1W, Umax = 8.8V, and Imax= 8.5A 

The overall design is based on Information provided by this website,  The Peltier device is what you would expect with, An Aluminum disk  fixed to the cold side of the peltier element a small Heatsink and a 24V Fan as seen in the photo are mounted on the warm side of the peltier. All Is built inside a cubic tin can.






To generate the PWM , first I used a microcontroller and then I experimented with a PWM IC (TL494)
The setup includes a step-up converter for the Fan and a linear regulator for the 5v Fan to cool the mosfets.

In the first test I could cool the metal Plate to 7.5 °C consuming about 8.5 W at Room temperature of 25°C





Monday, May 30, 2016

Finally: a working raspberry pi /matlab connection. Test: face Detection

Here is a demo of my working raspberry pi connected to my computer over the network.
For OS X users having problems installing the raspberry pi support package. Dont forget running matlab as an administrator before starting the installation.
Face Detection was the easiest way to test both the pi and the cam module.
Below you can find the matlab code for face detection with raspberry bei and you can also use any different cam bei slightly modifying the code.


clear rpi
rpi = raspi();
cam = cameraboard(rpi, 'Resolution', '640x480');

for i = 1:20
a = snapshot(cam);

% here i had to rotate the image becasue the way my pi is positioned 
img=imrotate(a,180); 
end

%Create a detector object.
faceDetector = vision.CascadeObjectDetector;

% Detect faces.
bboxes = step(faceDetector, img);

% Annotate detected faces.
IFaces = insertObjectAnnotation(img, 'rectangle', bboxes, 'Face');
figure, imshow(IFaces), title('Detected faces');

Friday, April 15, 2016

Tinman: voice activated bluetooth robot!




Built-in functionalities: 
- Bluetooth Speaker - Mod. Light - Mobile Phone charger  -Temperature sensor - Voice activated interface 

  The build is composed of the following parts: 
- Arduino nano 
- Emic 2 Text-to-Speech module 
- Voice Recognition module V2 
- Bluetooth Audio receiver + 2W Audio Amp. 
- 2x 8 ohm speakers
- 1x 4 ohm speaker
- 3,7V, 300mah lipo 
- 12V,1800mAh LI-ion Battery Pack 
- DC step down converter based on LM2596
- Inline relay for remote PWR and a toggle switch


Watch the first video ... Tinman in the club!

Sunday, April 3, 2016

matlab: ComputerVision, cell count and multiObject tracking demo.

Here is a short video to demo some of the stuff you can do with the Computer Vision toolbox in matlab. The code i used is based on different examples provided by the matlab website  (cell count and object tracking)
I still find the mathematics behind the scenes very difficult to understand but fortunately the matlab provides a certain degree of abstraction and at a some point i found myself tweaking specific functions based on some cryptic morphological parameters of the data and managed to port the code provided by matlab to work on the video i recorded previously with my usb microscope.
watch the video and have a look at the results:


Saturday, March 19, 2016

Guide to logic & Logic families by Texas Instruments!

While googling around to learn more about logic families and mixing different IC technologies, I came across this helpful pdf made by Texas Instruments. 

Here are some screenshots from the document to give you a glimpse on its content.



 

Here is a link to another tutorial on logic families and their advantages/disadvantages, application notes and important information on mixing different technologies.

Monday, March 14, 2016

Homebrew 4 bit CPU - Part2 (Registers, scratch-pad RAM and Breadboard maze)

Here is a quick update on my homebrew 4 bit CPU. 
After few hours with the jumper wires and breadboard I managed to create a nasty looking maze of connections, starting with the accumulator: I used a 74HCT173 D register and connected it so that it feeds the 4 bit output of the ALU (F0...F3) back to it's A input (A0..A3) .


The ALU is able to run arithmetic and logical operations on 2 operands A and B. The value of the A operand is provided by the accumulator which also stores the result of the operation. (control signal /LOADA )
Another 74HCT173 serves as the flags register, and it stores the carry output (Cn+4) bit and the Not Zero bit. The carry out bit is used for relative magnitude comparison and the Not Zero bit is the output of 3 OR gates (74LS32) and indicates if at least one line of the ALU 4 bit datapath is at High state. (control signal /LOADFLAGS)
One more 74HCT173 serves as an output register and stores the value on the Data Bus (control signal /LOADOUT) to deliver it later to the 7 segment Driver (74LS47)
Then there is the dual Bus Driver 74HCT244, which puts the ALU result on the Data Bus (orange wires in photo) when needed (/OEALU and /OEOPRAND control signals at pins 1 & 19, see nippler schematic)




Finally I got the 64 bit (4 x16)  RAM (SN7489) connected to the data bus, well the nippler uses a different 4 bit RAM, much larger and with a 12 bit Address Bus (A0..A11)
I still dont have the right PROM and EEPROMs for Program and Microcode so i was thinking maybe i could emblement both using a microcontroller and some i2c port expansion chip!?





Thursday, March 3, 2016

Homebrew 4 bit CPU - Part1 (ALU)


Inspired by the Nippler 4 bit cpu I decided to build my own based on the Nippler architicture (Harvard Architicture). However Im faced with a chalange of implementing the Nippler design using only component I have in my inventory. I honestly don't know what does this mean :-)
probably it's going to be a difficult task using different Flip Flops, EEPROM and SRAM .. who knows..
My goal is to learn with you as much as possible about CPUs and CPU design.

Now let's begin with the ALU ... a 4 bit Arithmetic Logic Unit, namely the 74LS181











In my first set up I only play around with the ALU using 2 dip switches (Red) for the operands (A and B) and another dip switch (blue) for selecting the ALU operation.

The schematic for the 7 segment display driven by sn7447N in my setup:




Sunday, February 7, 2016

Time with mr. LINUX ! PART02

 (If you have not installed and configured Arch linux yet, please check my previous post first) .


Linux filesystem 

A specific way in which files are stored on a disk is called file system: enables files to have names and attributes. It also enables them to be stored in a hierarchy of directories or folders arranged in a directory tree. The next figure shows how does linux organizes its directories. In linux everything is a file so there is no root directory (you won't find things like c: d: etc like in microsoft windows to represent storage devices and hard drive partitions).
Linux VFS (virtual file system) makes all the files on all the devices appear to exist in a single hierarchy.
Linux assigns a device name to each device but that is not how the files on that device are being accessed. to gain access to files on another device, the OS must first be informed where in the directory tree these files should appear (This process is called mounting a file system). The file system (device) includes a directory that is passed to the OS to be mounted (mount point). In part01 we learned about fstab configuration file provided by linux to facilitate mounting at boot time.
*Note: in the figure, jono, mako and cory are users of the systems.

Arch linux repositories and package Management

"A repository is a storage location from which software packages can be retrieved and installed on a computer." Arch linux official repositories include:
- basic: official binary repository
- core: Packages needed to, boot Arch linux, connect to the internet, building packages, and system setup processes.
- extra: desktop environment and programs. (packages that do not fit in core)
- community: Packages built by community (packages built by trusted AUR users: Archlinux User Repository)
- multilib: contains 32 bit software and libraries
Official packages are obtained by pacman (package tool/installer) from the Arch linux package tree and compiled either for IA-32 or x86-64 architectures. Binary packages use tar.xz format with .pkg placed before this (.pkg.tar.xz)
* There is also the Arch Build System (ABS) ( used in conjunction with AUR packages) which provides a directory tree of shell scripts called (PKGBuilds) that enable any and all official Arch packages to be customized and compiled. (more to ABS in future posts!)


Package Management (pacman)

Pacman is one of the major distinguishing features of Arch Linux and handles installation, upgrade, removal and downgrade of packages. It features an automatic dependencies resolution. pacman keeps the system up to date by synchronizing package lists with the master server. 
Here are the most important uses and options of pacman:

- Update the packages database: pacman -Syu
- Search for packages in the database: pacman -Ss string1 string2
- Search for already installed packages: pacman -Qs string1 string2 
- Display information about certain package: pacman -Si package_name
or  pacman -Qi package_name (installed package)
- Cleaning the package cache: pacman -Sc
- Install package/packages: pacman -S package1 package2 ..
- Remove a package/packages: pacman -R package1 package2 ..
or pacman -Rs package_name (remove package and dependencies)


More info and options: pacman !



Time with mr. LINUX ! PART01

In the next few posts, i will be introducing you and myself to the Arch linux (using command line interface only) and will try to make it a very compact tutorial that concentrates on the basics... however ..

Some necessary introduction

Linux is a beloved open-source OS that competes with both market monsters, Microsoft and Apple. There are 2 ways to operate a Linux OS; using a graphical user interface GUI (windows, icons, menus, etc ... the stuff you are familiar with in windows or osx) or using a command line interface CLI (shell). Due to its flexibility and configurability, linux variants include thousands of programs and applications and they are known as Distributions or distro (like Debian, Fedora, Ubuntu, ..etc ) to satisfy all kinds of needs and tastes.


Arch linux is one of these distributions (targets advanced users) that supports community involvement and consists predominantly of free and open-source software, and supports IA-32 and x86-64 architectures. 


x86-32 or IA-32 stands for Intel Architecture - 32 bit, sometimes called i386. This refers to the instruction set  architecture (ISA) that was first implemented in the intel 80386 microprocessors in the mid 80s.x86-64 on the other hand refers to the 64 bit version of the x86 architecture. By the way: an Instruction Set Architecture is a part of computer architecture that is related to the programing of a microprocessor (data types, registers, addressing modes, instructions , etc)


The 5 important steps:  get and install Arch linux

1- Lets go to the archlinux download page and download the latest release in a form of an iso image (about 701 MB in size) then create an Arch linux USB installer drive (LiveUSB) for booting in BIOS and UEFI (another firmware interface for PCs designed to replace the BIOS ). Here is how you create the LiveUSB:
Under Windows: Use a programs like Rufus to create a bootable USB drives (Rufus has an easy and multilingual interface, please check their website for details). 
Under OSX:  - Insert the USB key and then OSX will mount it automatically.- Go to terminal and type:  diskutil list to figure out the USB device name from a list of connected storage devices (usually appear as: disk1, disk2, ..)  - Unmount the USB key by typing:  diskutil unmountDisk /dev/disk#
- Navigate to the folder where you downloaded the iso image and then type: dd if=image.iso of=/dev/rdisk1 bs=1M
 - Finallydiskutil eject /dev/disk# before physical removal of USB key from computer. 
After booting the target computer from the USB key, you are automatically logged in as root.

LiveUSB Boot screen


2- Now it's time to partition and format the hard drive and we do that using fdisk and/or cfdisk partitioning tools:  fdisk -l  to list all available storage devices, then: cfdisk /dev/sda to use the partition tool. 

(note that cfdisk is similar to fdisk but has a different user interface. cfdisk has the advantage over fdisk in that it's possible to enlarge an extended partition when there is free space after it. )

I suggest that you delete all partitions on the target drive (To delete an existing partition, highlight it with the up and down keys, select the Delete command with the left and right arrow keys, and press Enter) then create a root partition (by selecting the new command.This partition will include most of the disk freespace) and make it of type bootable (by selecting the type command, and using the space bar to toggle between different types). Now create a second partition (a swap partition with 1/2 the size of installed RAM on the PC) and make it of type swap. Finally save/write (write command) and quit fdisk tool.
3- Create the file system on the root partition: mkfs.ext4 /dev/sda1 then mount: mount /dev/sda1 mnt  
4- Make a swap file on the swap partition: mkswap /dev/sda2 then utilize it: swapon /dev/sda2
5- Type pcstrap -i /mnt base base-devel to instal arch linux base system and development base system a on the mounted root partition.
*sda1 stands for root partition and sda2 for swap partition.
*The root partition is the disk partition that contains the root file system and on which the root directory is located.
*Swap space in Linux is used if the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.

Configuring the installation

- Now to access the new installed system type: arch-chroot /mnt
- Create a password for the root account by typing: passwd then the actual password after being prompted to do so.

Important setup (locale)

locale in arch linux refere to regional monetary values, time and date formats and other regional standards.
- To setup the system locale, type: nano /etc/locale.gen (nano is the name of the text editor tool we use to edit the locale.gen file).
- Uncomment the line referring to your region or country then use CTRL + o to save/write changes, press Enter then CTRL + x to quit.
...
#en_SG ISO-8859-1
en_US.UTF-8 UTF-8
#en_US ISO-8859-1
...
- Type locale-gen to generate the locale
Type : cd /usr/share/zoneinfo to navigate to the time zone settings. Type ls to list the different time zones.
- To confirm the chosen time zone setting type: ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
- Now we would like to setup a hostname, we do that by typing: echo my_hostname> /etc/hostname


Here we need to have a wired internet connection (Ethernet cable) to our target computer.
Check internet connectivity by pinging google.com for example..
ping -c 3 www.google.com

Installing the Bootloader (grub)

GRUB =  GRand Unified Bootloader, a very powerful newish BootLoader that can be used to boot most operating system on the intel platforms. Here think multiboot functionalities :-)

- First we download grub using the arch linux package manager (pacman)
  pacman -S grub-bios
then we install it by typing: grub-install /dev/sda
- Now generate the so called INIT files (Initialization files used by grub to load linux). 
do that by typing: mkinitcpio -p linux
- Create the grub configuration file: grub-mkconfig -o /boot/grub/grub.cfg
- Exit the current root session.
- Generate fstab file (a configuration file that controls with automating the mounting process of partitions): genfstab  /mnt >> /mnt/etc/fstab
- Unmount the Hard drive: umount /mnt
- Reboot (make sure to remove the installation LiveUSB before rebooting) 

Another necessary setup (Keyboard layout)

- Type localectl status to view the current keyboard configurations
   System Locale: LANG=en_GB.utf8
                  LC_COLLATE=C
       VC Keymap: cz-qwertz
      X11 Layout: cz
- Type localectl list-keymaps | grep -i  keyword  ( the keyword here could be something like us for United states, ch for Switzerland or de for Germany)
- After finding the right keymap for your keyboard type: localectl set-keymap --no-convert your_keymap
- Finaly load the keymap: loadkeys keymap

Final step (user account)

To create a user account type: useradd -m -G wheel -s  /bin/bash user_name
( -m =  create a user home directory in /home, -G = introduce a list of groups a user is part of, -s = defines the path- and file-name of the login shell)
Finally secure the new account with a password: type passwd then create the actual password. 

Now we are ready to start -linuxing- !