Dot Matrix Pen Write Screen

We were just wondering that in the current market where capacitive touch screens, resistive touch screens, TFT displays are flooding, Do-It-Yourself enthusiasts have been rarely used dot matrix screens. Here we use 5mm 8 * 8 dot matrix screen and phototransistor to achieve a pen write function. Sounds fun? But how to specifically make it? Can we achieve a larger area pen write?

The target is: to realize pen write on dot matrix.

LED matrix
Arduino UNO
PNP transistor
photosensitive triode
resistors (22K, 1K), pins

The project is mainly composed of three parts: row scan circuit, column scan circuit, the pen’s circuit. The principle block is as shown below. It has a photosensitive sensor in the pen, we use this pen to get the states of LED.


  1. Row scan

Make decoder’s Y0, Y1…effective in turn, but 74ls138 output low level on corresponding pin if have a effective input, because our dot matrix is common anode, we need an inverter, we use PNP transistor to constitute a inverter. Every eight times column scanning on a row scan.

  1. Column scan

Make decoder’s Y0, Y1…effective in turn, and input PWM on OE1, if OE1 is high level, Y0~Y7 are high level?if OE1 is low level, ABC pin decide decoder’s output. When enable some line, we make decoder’s Y0, Y1…effective in turn, and we can control every LED’s brightness by OE1.

  1. Pen

Set the reference voltage at the inverting input of comparator at a certain value, and in-phase input voltage will be less than this value when the pen receives light, vice versa. The current through R3 is very small if light is insufficient, so in-phase input voltage will be closer to the power supply voltage, and comparator outputs high level. The current through R3 will increase if light intensity increases, and the voltage of R3 will increase, so in-phase input voltage will decrease, then comparator outputs low level. MCU can catch this change and then does the corresponding processing.

If you're interested in this, click here to view detailed:

Program Analysis
To detect state of the points on the dot matrix we must light LED, and make it in the dim state, when the pen gets close to some point, we set the point highlight. But how do we know the coordinates of this point? The principle is: let LED light up one by one?the first of the first line, then the second of the first line…, until the last of the first line. Turn again the first of the second line, light up LED in turn in a loop. Every LED has state value: 0 stands for the dim state, 1 stands for highlight state. When the pen gets close to some point but it’s not the point’s turn to light up, because the pen did not detect light?it maintains a high level at the output of the comparator. When it’s turn to light up this point, comparator outputs a low level, MCU executes interrupt program when it detect a level change, and gets value of current row and column, then set state that find the point by value of row and column of 1, and set it to highlight state when it’s lighted up next time. We see the whole dot matrix light up when increasing scanning speed, rather than one by one.

Hi, are you asking questions of the forum, or displaying and demonstrating your completed project? If the former, please state your questions more clearly. If the latter, there is a Galery section of the forum for this purpose. You have posted in the area for questions and help.


Hi Paul,

Thanks for the tip. Can I remove the topic to Galery?

You could remove it and re-post to the Gallery, or you could ask a Moderator to move it for you, .e.g CrossRoads, AWOL, RobTillart

A few observations however. LED matrices are as a matter of definition not "common anode" or "common cathode". They can be defined as "row anode" or "column anode" etc. In your description here and on the other site, you refer to "needing an inverter" for the common anodes and are using PNP transistors but you have omitted (as far as I can see) to include the base resistors for these. You also have omitted the series resistors driving the cathodes and are running the 74LS138s way beyond their absolute maximum ratings.

In fact, you could better use a TPIC6B595 (shift register - even easier to control than a multiplexer) as a cathode driver in common cathode mode and switch anodes, either at a low current (4 mA) each or using a more capable high-side driver. Possibly just use the transistors as you presently do (with the correct resistors), but then have a properly designed system which is not overloading the ICs.

Now you are using some sort of reference to the comparator in your light pen circuit - which is presently drawn incorrectly here. What is the reference? Is it another PWM from the UNO? A PWM is a PWM, not an analog reference value. In fact, there is no need for a software-defined reference for the light-pen since it only needs to detect (positive) transitions/ pulses, so can and should simply have a high-pass filter function on the op-amp.

And using interrupts in this respect is quite inappropriate - you know when to expect a light pen input as you switch on each LED, so it makes far more sense to poll for it at that particular point.

Finally, I was hoping that you might be a little more imaginative and use something like a MAX7219 to (massively) simplify the driver circuitry - the challenge there being to figure out how to synchronise to its internal strobe.

I've asked you before, please don't change the thread title, unless there's a really good reason.
(I'm not seeing one in this, or many other recent cases)

You could remove it and re-post to the Gallery,

You can't remove posts - attempting to do so is (rightly) considered vandalism and reason to be banned.

or you could ask a Moderator to move it for you, .e.g CrossRoads, AWOL, RobTillart

That works. Using the "report to moderator" link. :smiley:

I've asked you before, please don't change the thread title, unless there's a really good reason.
(I'm not seeing one in this, or many other recent cases)

And you propose doing what to me?

{Do you post to any other forums beyond Arduino, perchance?}

I'm not proposing doing anything to you - how could I?
Your mutilated replies, on the other hand, are fair game.

(And yes, I do post on other forums, though I assume your question is some kind of non sequitur)