TFT pixels in focus under high magnification microscope
Whilst working on this post I managed to get some sexy shots of pixels in focus from my TFT screen under the microscope.
Whilst working on this post I managed to get some sexy shots of pixels in focus from my TFT screen under the microscope.
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
High zoom
Regular Pixel
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).
Now much clearer under blue led illumination:
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.
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?
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)
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).
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.
I wont explain all of the theory or background as it is already explained on cheapvegetablegardener.
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:
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:
And the second (maximum zoom):
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:
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.
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.
So I got a little carried away and started to take images of everything with my microscope:
Electronics
Materials
Eyes
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.
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.
Quick Review
Advantages
Disadvantages
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
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.
Pretty images
Any requests for microscope images (within reason) will be considered
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.
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
}
}
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