Archive

Posts Tagged ‘Electronics’

TFT pixels in focus under high magnification microscope

June 11th, 2010 mat No comments

Whilst working on this post I managed to get some sexy shots of pixels in focus from my TFT screen under the microscope.

Regular pixels from a TFT screen

Regular pixels from a TFT screen

Cool Focusing on pixels from a TFT High magnification

Cool Focusing on pixels from a TFT High magnification

More Cool Focusing on pixels from a TFT High magnification

More Cool Focusing on pixels from a TFT High magnification

Categories: Electronics, misc Tags: ,

Nexus One’s AMOLED Screen under the microscope

June 10th, 2010 mat No comments

After casually browsing this wikipedia article on google’s Nexus One (or HTC’s) I became interested in the AMOLED (Active-matrix OLED (Organic Light Emitting Device) screen due to its interesting pixel structure. Quote from wikipedia:

The Nexus One has a 3.7 inch AMOLED screen with PenTile matrix pixel arrangement. The raster resolution is 800×480 pixels, however each pixel in the PenTile RGBG display has only two subpixels (red and green, or blue and green alternately), rather than the three found in most displays. This gives it a total effective subpixel resolution of a 392×653 RBG display.[40]

So I decided to have a look under the microscope to see what I could find with my nexus one. Enjoy the following images:

Low Zoom

Nexus One's AMOLED screen under the microscope (Low magnification)

Nexus One's AMOLED screen under the microscope (Low magnification)

High zoom

Nexus One's AMOLED screen under the microscope (High magnification)

Nexus One's AMOLED screen under the microscope (High magnification)

Nexus One's AMOLED screen under the microscope (High magnification)

Nexus One's AMOLED screen under the microscope (High magnification)

Regular Pixel

Regular pixels from a TFT screen

Regular pixels from a TFT screen

Dell 1320c colour laser printer (Machine Identification Code microdots)

April 5th, 2010 mat No comments

As you may or may not be aware some printers add extra information in order for the printer to be identified (primarily for counterfeiting case I believe). With colour laser printers this can be in the form of a small array of yellow dots printed onto you paper. Yellow dots are hardly visible to the naked eye, however if you are close enough and get the light at the right angle you can see them. If you have some blue leds or a blue light available this can make it much easier to see the dots (as the yellow dots will absorb the blue and look black).

CUPS test paper with non-visible yellow dots

CUPS test paper with non-visible yellow dots

CUPS test paper with non-visible yellow dots (closer)

CUPS test paper with non-visible yellow dots (closer)

Now much clearer under blue led illumination:

Yellow dots very clear under blue illumination on the dell 1320c colour laser printer

Yellow dots very clear under blue illumination on the dell 1320c colour laser printer


Yellow dots very clear under blue illumination (zoomed in)

Yellow dots very clear under blue illumination (zoomed in)

Unfortunately I my camera isn’t good enough quality and it doesn’t have a macro lens or feature so I can only show images at both extremes. Below are images captured with my microscope, you don’t have to look very far around the page, as the clusters are littered all over the page.

Microscope image of a few yellow dots on paper printed with dell 1320c

Microscope image of a few yellow dots on paper printed with dell 1320c

Microscope image of a two yellow dots (max zoom)

Microscope image of a two yellow dots (max zoom)

The Electronic frontier foundation have more information about the dots and have setup an address you can send a print test page to in order for them to build up a public defence case. Perhaps criminals will end up printing with yellow backgrounds to combat this method?

Installing a Dell 1320c colour laser printer in ubuntu (kubuntu 9.10 x86_64)

April 5th, 2010 mat No comments

This is a nice colour laser printer that I managed to pick up quite cheaply with 2 sets of toner.

Problem

On my system (kubuntu 9.10 x86_64) it did not appear in lsusb and dmesg showed the following:

[15208.550014] usb 1-6: new high speed USB device using ehci_hcd and address 10
[15208.701200] usb 1-6: configuration #1 chosen from 1 choice
[15208.741575] usblp0: USB Bidirectional printer dev 10 if 0 alt 0 proto 2 vid 0x413C pid 0×5516
[15208.741596] usbcore: registered new interface driver usblp
[15209.747326] usb 1-6: usbfs: interface 0 claimed by usblp while ‘usb’ sets config #1

Funnily enough it did appear in the list of devices in virtualbox, however I had no luck trying (and didn’t really want to) to install it virtually. So I decided I’d make use of the built in network abilities of the printer and plug it directly into the router (I didn’t do this initially as I wanted the printer in a different room to the router).

Solution

After setting the printer up on the network, I ensure logged into the web interface and changed the password from the default. I then followed this thread on the ubuntuforums which refers to this text for installing the “Fuji Xerox DocuPrint C525A” driver which is compatible with the dell 1320c.

The driver is an 32bit rpm by default (which is fine for redhat based os’s), you can use alien to convert the rpm to an deb, or you can just download a prebuilt deb from zoffix.com (Direct link. This is a 32 bit package still so we need to install it using “–force-architecture”

sudo dpkg -i fuji-xerox-docuprint-c525-a-ap_1.0-2_i386.deb –force-architecture

Once this driver is installed you can login to cups and configure your printer as you would normally (instructions below). However when you are required to select the printer you need to provide the ppd file manually if you have installed the driver

1 – Open a webbrowser and goto http://localhost:631/admin
2 – Click add printer
3 – Enter a name for the printer eg: dell1320c (spaces are not allowed)
4 – Enter the printer address. This is the ip address of your printer prefixed with “lpd://”. eg: lpd://192.168.1.121
5 – Either locate Fuji Xerox DocuPrint C525A or select the ppd directly which is located at /usr/share/cups/model/FujiXerox/en/FX_DocuPrint_C525_A_AP.ppd
6 – Memory Capacity should be 64MB, and Optional Tray Module should be 250 Sheet Feeder
7 – finish.

Bypass tray problem

You should now print a test page, however if you get the problem like me that the printer always attempts to load paper from the manual paper feed, you will need to change the paper source from bypass tray to tray 1 in each program you need to print with (hopefully there will be a fix for this, but in this cups there seems no option to set it)

Select tray 1 to avoid using bypass paper with dell 1320c in ubuntu

Select tray 1 to avoid using bypass paper with dell 1320c in ubuntu

Additional

I also noticed that this printer was covering each printed page with tiny yellow dots, which can be used to identify a printer (most likely for criminal matters).

Categories: Electronics, Linux Tags: , ,

DIY soil moisture sensors

March 28th, 2010 mat No comments

I’ve been looking into creating an automated herbarium of some sort for a while, and I came across the brilliant post about creating some DIY soil moisture sensors using nails and plaster of paris. cheapvegetablegardener from hackaday.

Plaster of paris humidity sensor

Plaster of paris humidity sensor

Plaster of paris humidity sensor with wires attached

Plaster of paris humidity sensor with wires attached

Both of the sensors

Both of the sensors

I wont explain all of the theory or background as it is already explained on cheapvegetablegardener.

Resistance experiment on moisture sensor

Resistance experiment on moisture sensor

I measured the resistance of the sensor in air to be 12Kohms, I then placed the sensor into water (keeping the nail heads above the surface). The resistance dropped to 4Kohms whilst in the water, and then over 20 mins of back in air the resistance rose to 5.6Kohms. The sample still looks and feels quite wet, so I imagine it is going to take some time to dry, but from these prelimary results we can see it appears to work.

Soldering the wires to the nails before creating the plaster of paris along with covering the end sensor with hot glue would improve its longevity. I will post again once I find a better mould to make the plaster in as it was quite difficult to get them out of the cuvettes (I had about a 50% success rate).

Here is a microscope image of the surface of the plaster:

Microscope image of the surface of the plaster of paris

Microscope image of the surface of the plaster of paris

Measurement of microscope capabilities.

March 27th, 2010 mat 1 comment

As requested (by uplink) here are some images and calculations of the microscopes maximum zoom.

The images are taken with the edge of the camera case pressed right up against the ruler. You could probably remove casing to increase zoom slightly, or create a slot to slide a microscope slide into it. The camera has two focuses the first:

Usb digital microscope's first zoom level of a ruler (markings at 0.5mm)

Usb digital microscope's first zoom level of a ruler (markings at 0.5mm)

And the second (maximum zoom):

Usb digital microscope's full zoom level of a ruler (markings at 0.5mm)

Usb digital microscope's full zoom level of a ruler (markings at 0.5mm)

I am using my laptop screen as a typical screen and viewing the image at 100%. Poor mans calculations give you the following for the first focus and second focus:

1mm displayed over 40mm: zoom ~ 40x
1mm displayed over 150mm: zoom ~ 150x

(Note: Measuring magnification level is rubbish as it depends on screen the image is viewed on, so viewing it on a projector would make the statistics seem more impressive.)

The minimum zoom is less than this as we can move the camera further from the object:

Usb digital microscope's minimum zoom level of a ruler (markings at 0.5mm)

Usb digital microscope's minimum zoom level of a ruler (markings at 0.5mm)

Which is about 15x zoom. The microscope box states the zoom is between 10x and 200x, which from these tests seems a little over-exaggerated but not by much.

Microscope images of my eye (by request)

March 26th, 2010 mat No comments

More microscope image of eyes were requested (by Benjie), trying to focus more on the detail of the eye by using external illumination. Unfortunately the camera has some colour problems when not using the built in LEDs, possibly because it attempts compensates for the lack of illumination. Hopefully I am not in danger of someone cloning my retinal scan to gain access to my confidential files.

Black and white microscope image of my eye

Black and white microscope image of my eye

Clear reflection of my laptop in a black and white microscope image of my eye

Clear reflection of my laptop in a black and white microscope image of my eye

Coloured illuminated microscope image of my eye

Coloured illuminated microscope image of my eye

Coloured illuminated microscope image of my eye (see the blood vessels)

Coloured illuminated microscope image of my eye (see the blood vessels)

Categories: Electronics, misc Tags: , ,

More microscope images (21)

March 20th, 2010 mat 5 comments

So I got a little carried away and started to take images of everything with my microscope:

Electronics

Magnified image of an intergrated circuit chip

Magnified image of an intergrated circuit chip

Magnified image of an surface mount LED

Magnified image of an surface mount LED

Magnified image of an another integrated circuit chip

Magnified image of an another integrated circuit chip

Magnified image of yet an another integrated circuit chip

Magnified image of yet an another integrated circuit chip

Magnified image of a crocodile clip

Magnified image of a crocodile clip

Magnified image of a surface mounted resistors

Magnified image of a surface mounted resistors

Magnified image of a digital printed circuit board

Magnified image of a digital printed circuit board

Magnified image of a digital camera

Magnified image of a digital camera

Magnified image of a camera focussed on the glass

Magnified image of a camera focussed on the glass

Magnified image of a camera

Magnified image of a camera

Magnified image of a headphone

Magnified image of a headphone

Magnified image of a mobile phone speaker

Magnified image of a mobile phone speaker

Magnifieid image of a DVD

Magnifieid image of a DVD

Materials

Magnified image of a dry sponge (with some solder burns)

Magnified image of a dry sponge (with some solder burns)

Magnified image of a wet sponge (with some solder burns)

Magnified image of a wet sponge (with some solder burns)

Magnified image of a caramel shortbread biscuit

Magnified image of a caramel shortbread biscuit

Magnified image of a flapjack

Magnified image of a flapjack

Magnified image of demin

Magnified image of demin

Magnified image of paper

Magnified image of paper

Eyes

Magnified image of the queen's eye from a £10 note

Magnified image of the queen's eye from a £10 note

Magnified image of an eye

Magnified image of an eye

Note the reflection in the image of my eye, if you zoom in and enhance you may be able to read what is on my screen which will then possibly lead to the solving of a murder.

DigiMicro 200X Zooming USB Digital Microscope in ubuntu (linux)

March 20th, 2010 mat 1 comment

I’ve wanted a USB microscope for a long time, and I have finally purchased a DigiMicro 200X Zooming USB Digital Microscope from dealextreme (product link) It only cost $40.23 USD (about £27.34 GBP) which I think is quite reasnoble for the fun and cool photos I’m getting out of it.

DigiMicro 200X Zooming USB Digital Microscope

DigiMicro 200X Zooming USB Digital Microscope

Quick Review
Advantages

  • Very Cheap
  • Easy to setup (plug and play)
  • Can take some awesome photos, see below
  • Three illumination settings (full on, half on, off) on top of software compensation

Disadvantages

  • Controls (lights, zoom/focus and snapshot) are located on the body which make using them difficult if you are trying not to move your sample
  • The stand is not very stable, tightening it to maximum holds it steady at certain angles for short periods of time
  • Takes ~ 2 weeks to arrive from dealextreme as they are based in hong kong

Setup

The beauty of this webcam is that it requires no installation with ubuntu 9.10 you simply need to run the software and the camera works! woo! The output of `lsusb` shows the device as:

Bus 001 Device 006: ID 0c45:62e0 Microdia MSI Starcam Racer

and `dmesg` shows the following:

[22844.064666] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (0c45:62e0)
[22844.080844] input: USB 2.0 Camera as /devices/pci0000:00/0000:00:0b.1/usb1/1-6/1-6:1.0/input/input9

Software
Most video programs will pick up the device, I am opting to use a program called cheese which is awesome not only because of the name but also because of its simplicity.

sudo apt-get install cheese
Screenshot of cheese webcam software in action

Screenshot of cheese webcam software in action

Lens Cap
Remember to take the lens cap off otherwise you will end up focusing on the plastic cap as shown below. It is fairly obvious if this is the problem as moving the microscope will only change the light levels not the image.

Photo of the microscope focussed on its lens cap

Photo of the microscope focussed on its lens cap

Pretty images

200x Microscope image of belly button fluff

200x Microscope image of belly button fluff

Full ~200x zoom microscope image of belly button fluff

Full ~200x zoom microscope image of belly button fluff

200x Microscope image of a £2 coin

200x Microscope image of a £2 coin

Full ~200x zoom magnified section of a £2 coin

Full ~200x zoom magnified section of a £2 coin

200x Microscope image of a custard blob

200x Microscope image of a custard blob

Nonmagnified screenshot of section of screen with the google logo

Nonmagnified screenshot of section of screen with the google logo

200x magnified section of screen with the google logo showing the individual pixels

200x magnified section of screen with the google logo showing the individual pixels

Full ~200x zoom magnified section of screen with the google logo showing the individual pixels

Full ~200x zoom magnified section of screen with the google logo showing the individual pixels

Full ~200x zoom magnified section of my finger

Full ~200x zoom magnified section of my finger

Full ~200x zoom magnified another section of my finger

Full ~200x zoom magnified another section of my finger

Full ~200x zoom magnified section of an LED

Full ~200x zoom magnified section of an LED

Full ~200x zoom magnified section of an LDR

Full ~200x zoom magnified section of an LDR

Any requests for microscope images (within reason) will be considered :)

Python: interfacing with an arduino

February 3rd, 2010 mat 3 comments

So what is an arduino?
An arduino is an open source open hardware programmable controller with several inputs and outputs. The image below shows an Ardunio Dicemella.

Ardunio Dicemella Annotated Photo

Ardunio Dicemella Annotated Photo

It (Arduino Dicemella) has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

They are very useful for people who know how to program but have little experience with hardware interaction.

Programming the arduino
This post will not contain in-depth detail on how to program the arduino, instead focussing briefly on setting up serial (over serial or usb cable) communications in order to talk to a python script. The arduino can be programmed via a IDE provided by the creators in a C-style hardware language.

Code example

int ledPin = 13;            // choose the pin for the LED
int inputPin = 2;          // choose the input pin (for a pushbutton)
int val = 0;                // variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare pushbutton as input
}

void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
  }
}
Arduino LED switch circuit off

Arduino LED switch circuit off

Arduino LED switch circuit on

Arduino LED switch circuit on

Now we add a few lines to enable the writing of information from our arduino over the serial connection. We first need to set up the transfer speed in our setup (Serial.begin(9600);). Then we can simply send messages over serial using Serial.print(“message\n”);. You can choose between print and println with the difference been that the latter automatically appends the newline char, so we would use the former to write multiple things to the same line. Below is our modified code:

Serial write example

int ledPin = 13;           // choose the pin for the LED
int inputPin = 2;         // choose the input pin (for a pushbutton)
int val = 0;               // variable for reading the pin status

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare pushbutton as input
  Serial.begin(9600);
  Serial.print("Program Initiated\n");
}

void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    Serial.print("LED Activated\n");
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
  }
}

We now add into this code the ability to receive information via serial. Below is the modified example which removes the action of the button and replaces it by activating the LED when ‘Y’ is sent via serial.

Serial read example

int ledPin = 13;  // choose the pin for the LED
int val = 0;      // variable for reading the pin status
char msg = '  ';   // variable to hold data from serial

void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  Serial.begin(9600);
  Serial.print("Program Initiated\n");
}

void loop(){
        // While data is sent over serial assign it to the msg
	while (Serial.available()>0){
		msg=Serial.read();
	}

  // Turn LED on/off if we recieve 'Y'/'N' over serial
  if (msg=='Y') {
    digitalWrite(ledPin, HIGH);  // turn LED ON
    Serial.print("LED Activated\n");
    msg=' ';
  } else if (msg=='N') {
    digitalWrite(ledPin, LOW); // turn LED OFF
  }
}

Interaction with python

First we import the serial library to python in order to communicate with the arduino (this includes talking over usb).

import serial

We then attempt to connect to our arduino on /dev/ttyUSB0, using try and except to catch an exception if we are unable to find the arduino on USB0. The 9600 corresponds to the baud rate (speed of communication) that we are using with the arduino and should be the same as set in the program on the arduino otherwise your communication may appear garbled.

try:
	arduino = serial.Serial('/dev/ttyUSB0', 9600)
except:
	print "Failed to connect on /dev/ttyUSB0"

The address will be /dev/ttyUSB# where # is replaced by a number for arduinos connected via usb and /dev/ttyS# where # is replaced by a number for arduinos connected via serial. If you are not sure of the location of your arduino, it can be found in the arduino IDE or you can write some python to scroll through possible locations until a response is found

locations=['/dev/ttyUSB0','/dev/ttyUSB1','/dev/ttyUSB2','/dev/ttyUSB3',
'/dev/ttyS0','/dev/ttyS1','/dev/ttyS2','/dev/ttyS3']

for device in locations:
	try:
		arduino = serial.Serial(device, 9600)
	except:
		print "Failed to connect on",device

You may need to be careful as other devices can be connected. For example if I try to connect to /dev/ttyS0 I will connect to the wacom tablet on my laptop.

Once you have connected to your arduino successfully you can write information to it using write and read information sent from it using read (you will need to import time to use the sleep function). If your arduino does not send any messages via serial then attempting to readline will result in your program hanging until it receives a message.

try:
	arduino.write('Y')
	time.sleep(1)
	print arduino.readline()
except:
	print "Failed to send!"

So the python code should now look like the following and we should be able to control the LED over serial.

import serial
import time

locations=['/dev/ttyUSB0','/dev/ttyUSB1','/dev/ttyUSB2','/dev/ttyUSB3',
'/dev/ttyS0','/dev/ttyS1','/dev/ttyS2','/dev/ttyS3']  

for device in locations:
	try:
		print "Trying...",device
		arduino = serial.Serial(device, 9600)
		break
	except:
		print "Failed to connect on",device   

try:
    arduino.write('Y')
    time.sleep(1)
    print arduino.readline()
except:
    print "Failed to send!"

The above will send the character ‘Y’ (Y for Yes please turn on the LED) to the arduino wait for 1 second and then read from the arduino which will have hopefully posted a response to our ‘Y’. Using the program on this should turn the LED on, and report LED Activated back via serial to our python program. This should be enough for people to get started with ardunios and communicating with them in python.

References

  • Arduino – The arduino website with everything you are likely to need (programming examples and reference guide, and hardware information)
  • Arduino tutorial – a basic and easy to understand tutorial on programming the arduino
  • Python port of arduino-serial.c – By John Wiseman from which I based my program.
  • original arduino-serial.c – by Tod E. Kurt.
  • Sparkfun – Here is a good place to purchase ardunio and other electronics parts. Try coolcomponents if your from the uk like me
  • Dealextreme – Hong Kong based retailer that sells a lot of cheap DIY electronics and also has worldwide free delivery with no min spend (crazy). Does take about two weeks to arrive though (uk).
Categories: arduino, python Tags: , ,
// unused langs // // // //