How to Make a POV Display (Persistence of Vision) | Arduino Electronics Project

Hi Guys,
In today’s video I am going to show you, how I made a persistence of vision or pov display
that can display text, basic graphics and animations. The display is circular with a resolution
of 8 x 64 pixels It consists of 8 leds, which are mounted on
a disc and connected to an Arduino pro mini. When the disc spins the microcontroller on
the pro mini turns the leds on and off in a programmed sequence and this creates an
image on the disc. The process relies on persistence of vision
or positive after images, where visual perception continues sometime after the event. For the pov display to turn the leds on and
off at the correct times it uses a device called a hall effect sensor to indicate the
start point of each revolution of the disc. A hall effect sensor is a device used to sense
magnetic fields. The device I am using is a Bipolar hall effect
sensor and it acts like an on off switch The south pole of a magnet turns it on and
the north pole turns it off. Two small magnets are located on the back
of the display and when the hall effect sensor passes them by it generates a pulse. A timer on the microcontroller measures the
time taken for one revolution of the disc by measuring the duration between consecutive
pulses. This time is then divided by 64 and programmed
into a second timer. The second timer then operates at this time
interval, updating the leds 64 times per revolution. The process is repeated continuously with
the first timer updating the second timer at the end of each revolution. The result is that the pattern is displayed
in exactly the same position each time, even thought the speed of the disc is not constant. This project video is sponsored by JLCPCB JLC PCB specialises in the manufacture of
printed circuit board prototypes and small batch productions. They have over 10 years experience producing
printed circuit boards, serving 200,000 customers and processing over 8,000 online orders per
day. And the great news is that not only are they
a large scale, professional, high quality manufacturer;
But they also have a fantastic offer for you to produce your own printed circuit boards,
at incredibly low prices. And when I say incredible, I am talking about
2 dollars for ten double-sided printed circuit boards, that’s cheaper than you can buy the
materials So head on over to the JLCPCB website and
upload you Gerber files, to experience just how easy it is, to turn your designs, into
commercial quality products. So to start with lets have a quick look at
the parts I have tried to make this easy to build, so
the disc is made from a couple of old cds or dvds. The back is a clear disc which is usually
supplied with a stack of blank dvds but another cd is fine. A fidget spinner – remember those! Some metric M8 nuts, bolt & washers. I will
list all the sizes in the video description. 8 x 3mm red leds 8 x 220R resistors An Arduino pro mini or a clone.
I used an 8Mhz pro mini but 16 Mhz should be fine. A 150mAh or similar capacity rechargeable
lithium battery, mine came from a toy helicopter. A TP4056 lithium charger module with protection. To reduce the charging current from the module
we need a 10k surface mount resistor; but you can use a normal resistor A section of veroboard or copper stripboard.
A U18 bipolar hall effect sensor. An 0.01uF ceramic capacitor.
A 10k resistor. And also to program the pro mini you will
need a USB to serial adapter. I recommend the FTDI FT232RL types. A length of ribbon cable, I used an old computer
ide disk cable. A slide switch. And two small neodymium magnets. So all of those parts are listed in the description
along with all the other information you need to build the project. So onto the build: The first job was to glue the two cds together.
I lightly sanded each side. Applied glue.
And then they were pressed together using an M8 bolt for alignment .
To mark the position of the holes in the disc, I used an 8mm brad point drill bit; which
fits perfectly in the centre hole of the fidget spinner bearing.
The fidget spinner was located on the disc, once again using the bolt for alignment.
And then the tip of the brad point drill was used to make a pilot hole in the disc. The hole was then enlarged to 8mm using a
series of drills with increasing diameters and finishing off with a step drill. I then bolted on the fidget spinner and used
that as a guide to drill the other two mounting holes Next I created a paper template for drilling
the led holes. This was attached to the disc using water-soluble
glue. As an alternative to drilling, I used an old
soldering iron bit to melt the pilot holes; which worked well. And the holes were then enlarged to 3mm, the
same as the led diameter. To give the bolt head some clearance and allow
the disc to spin freely the centre hole in the disc was enlarged with some sandpaper. And the disc was then spray painted matt black
to improve the contrast with the leds. Once the paint was dry it was time to mount
the leds. Each led was tested with a 3v coin cell. The positive side of the battery should be
connected to the anode, which can be identified by the longer lead. The leds were then glued into the holes with
Cyanoacrylate adhesive otherwise known as superglue. The longer anode leads were all oriented to
the right in the clockwise direction. The shorter cathode leads were all bent over
with a pair of thin nose pliers. And a length of wire was soldered between
them to form the common side of the led array. I traced the outline of the fidget spinner,
to help with placing parts on the disc. To connect the leds to the pro mini board
I used a length of ribbon cable. This was cut form an old pc ide cable, but individual
wires work just as well. The ribbon cable was folded over twice to
get it around the fidget spinner and I tacked it together with superglue. The first six wires were soldered to the corresponding
led anodes leads. Then the 8th and 9th wires were crossed over
and then soldered to the 7th and 8th leds. The 7th wire was soldered to the common cathode
side of the led array. Next I soldered eight 220 ohm resistors to
the Pro mini. Starting with RX and TX pads and then pads
2 to 7. I cut two sections from one of the pro mini
pin headers. And soldered one onto the gnd and reset pads. and then the other onto pads 8 & 9. I then soldered the other pin headers onto
the remaining pads, with the exception of the serial programming pads on the end of
the board. Most of the connections are unused in the
project; but the header pins makes it easy to access them if required in the future. The ribbon cable was then soldered to the
pro mini. First to the two resistors connected to tx
and rx. Then to the ground pin. And then to the remaining resistors. To test the leds were correctly wired I uploaded
a sketch that flashed them in sequence. You can find the link to this in the video description. To temporarily connect the usb serial adapter,
It’s pins can be pushed into the through plated holes on the pro mini, making sure to align
the two vcc connections. The supply voltage should be set on the adapter. And in the Arduino ide software the board
type should be set to pro mini, the comm. Port selected and the type of processor to
ATMEGA328P and either 8MHz or 16Mhz as appropriate. The next part of the project was to create
a small circuit board on which to mount the hall effect sensor. This was cut from piece of stripboard. Then I inserted an 0.01 uf ceramic capacitor. And a 10k resistor. And soldered them in position. That was followed by the two pin header. The hall effect sensor. And the three pin header. Next I modified the charger module. This was
to reduce the maximum charging current to suit the 150mah battery. To do that the resistor
R3 was changed to 10K ohms. First I heated up the existing surface mount
resistor and remove it. Placed the new resistor. And then soldered it back in position. Then I soldered wires to the pads on the module,
two for the battery and two for the power output. I soldered the battery to the charger module
and insulated the connections with heatshrink tubing. Soldered the positive output from the charger
module to the switch. and then checked the output voltage with a
voltmeter. Soldered the switch to the positive input
of the hall effect circuit board. And then soldered the negative output from
the charger module to the ground on the hall effect circuit board. I fitted the fidget spinner to the disc. Fixed the ribbon cable down with hot glue. Then the pro mini.
Followed by the charger module, switch and the hall effect circuit board. Next I soldered the positive output from the
hall effect circuit board to the vcc pin on the pro mini. Then I soldered the ground pin on the hall
effect circuit board to the gnd pin on the pro mini And finally soldered the data pin on the hall
effect board to pin 8 on the pro mini. If we turn on the switch, then the sketch
that we uploaded earlier should cycle through the led. Initially the battery was attached with double-sided
tape, so that it could be moved around the disc later to improve the balance. Without balancing the disc vibrates quite
significantly. The back of the pov display was made from
a clear plastic disc, which came from a stack of blank cds. The centre hole was too large for the bolt,
so I glued an M8 washer to the centre using a nut, bolt and washer as a guide The back was installed and the hall effect
sensor was bent over to give clearance. Then I uploaded a sketch to show the output
of the hall effect sensor on the led array. Two neodymium magnets were placed on the disc, one with South Pole facing down and the other with the North Pole facing down. To determine which pole was which, the Hall
effect sensor was used. The South Pole switches it on, extinguishing
the leds and The North Pole turns it off, lighting up the
leds. Once the correct positions were found, the
disc was marked and two holes were drilled in the disc with
the same diameter as the magnets. The magnets were then installed into the holes and tested before they were permanently glued in position. That’s the disc constructed but it must be
balanced to run smoothly. I have used two methods: The first was to mount the disc vertically
-and when the disc is out of balance it rotates. The second method was to make a small cone
balancer. I did that by cutting a small circle out of
cardboard, cutting a triangle out of the circle and forming it into a cone. I drilled a hole in a block of wood to mount
a pen. And then the cone was placed on top. The disc is placed on top of the cone and
then if it is balanced it will remain horizontal. If its not it will tip over. To achieve balance, I moved the battery position
and added extra washers. I also filed down two of the washers to reduce the weight. And the result is a well balanced disc, which
spins without any vibration. Then we just need to assemble the front and
back Charge the pov display, the led turns blue
when its fully charged. And upload a sketch which you can find a few
on my website, so just copy and paste that into the arduino ide and upload it. 01 Finally lets have a look at how the POV works. Basically it’s a display with 8 rows x 64
columns bent around into a circle. The data to be displayed in each column is
held in a memory array called: PovDisplayData WHICH HAS 64 BYTES and the individual leds are represented by
the 8 bits in each byte. If the bit is set to a one then the led is
on and if it is set to a zero then the led is off So for example if you set bit zero of povDisplayData[0]
to a 1 Then the led will light up in the first row
of the first column If you set all the bits to one povDisplayData[0]
Then all of the leds light up in the first column And if you set all the bits to one in povDisplayData[15]
The all the leds light up in the 16th column So by setting or clearing the bits in each
byte of the memory array you can display whatever you like. Timer 1 on the microcontroller is at the heart
of the process that transfers the data from the memory array to the leds, this is a 16
bit timer and it performs two functions. Firstly, it measures the time duration of
each revolution of the disc and secondly, it outputs the data to the leds at an interval
of 1/64th of that measured time duration. Timer 1 is configured in normal mode to generate
both input capture interrupts and output compare match interrupts. The hall effect sensor is connected to the
timer 1 input capture pin ICP1. And the leds are connected to the PORT D output
pins. Timer 1s counter TCNT1 initially starts at
zero and counts upwards at a rate defined by the clock frequency. The hall effect sensor generates a pulse when
the magnets pass by. And that pulse signals to timer 1 that it
should store the value of its timer TCNT1 in the input capture register ICR1 It also signals to the processor to run the
input capture interrupt routine. This means that the processor interrupts normal program
execution and runs the interrupt service routine instead. The first thing that the input capture interrupt
service routine does is to reset the timer counter TCNT1 back to zero. Then it resets the current display column,
which is held in a memory variable back to zero. It calculates the time count required to travel
1/64th of a revolution by dividing the value of the input capture register ICR1 by 64. And then it updates the Output Compare Register
OCR1A with this value. The interrupt routine then exits and the processor
returns to normal program execution. Meanwhile the counter continues to count and
when it matches the value in output compare register OCR1A it signals to the processor
to run the Output compare interrupt. This interrupt increases the value in OCR1A
by adding a count equivalent to 1/64th of a revolution. It outputs the data byte from the povDisplayData
memory array for the current display column to the output port D on the microprocessor,
which lights up the leds following the bit pattern in the byte. Finally the display column memory variable
is incremented. The output compare interrupt is called every
1/64th of a revolution outputting bytes from the povDisplayData memory array until a full
time period has passed. Meanwhile the counter TCNT1 continues to count
and when the hall effect sensor detects a magnet again the whole process is repeated,
with the timer measuring the time period for each revolution and outputting the data at
1/64th of that time period. Lets have a look at the sketch First we have a constant for the input capture
pin ICP1 which is pin 8 Then we have a variable called povDisplayColumn,
which holds the next column to be updated on the display. A memory array called povdisplaydata, which
has 64 bytes and contains the data to be displayed on the screen. In this case I have initialised the array
with some fixed data. Then the PORTD pins on the microprocessor
are set to outputs And the leds are all turned off The input capture pin ICP1 is set to an input Then we configure Timer 1 Firstly resetting the Timer control registers
TCCR1A and TCCR1B to zero which puts it into normal mode. Resetting timer 1s counter TCNT1 to zero And then setting an initial value for the
output compare match register OCR1A Timer counter control register 1B is configured
by setting different bits. The input capture noise canceller bit is set.
This rejects spurious noise from triggering the input capture by taking four successive
samples of the input. The input capture edge select bit is cleared.
so that a negative edge will trigger an input capture.. And the clock prescaler is set to divide by
one. This was selected because larger counts lead to greater positioning accuracy. Next we configure the timer interrupt mask
register TIMSK1 Setting the bits to enable the input capture
interrupt, output compare A match interrupt and also the timer overflow interrupt. The we have the main program loop, which is
empty, but this is where you would normally modify the contents of the povDisplayData
memory array to display what you want on screen. Then we have the timer 1 input capture interrupt
routine First we work out the time count required
for one column Reset timer1s counter Reset the display column back to the start And then set the output compare match register
with the target value for the start of the next column Next we have the timer1 compare match interrupt
routine Which updates its own output compare match
register with the target value for the start of the next column And outputs the next byte from the povdisplaydata
memory array to the PORTD output port If the pov has stopped spinning then the leds
are turned off. And finally the povDisplayColumn is incremented
to the next column. So that’s how it works. For a deeper understanding,
the timer 1 section in the Atmega328P datasheet is a good place to start. The sketches are available from my website
and you can find a link to them in the video description. While I was programming the sketches I used
this little stand that made it easy to update and test the pov. Its just a bolt glued to
a piece of wood. The project has been a lot of fun, filming
it however, has been a bit of a challenge, as the camera usually operates at a much faster
frame rate than the pov display; and the resulting video is different from
what you would see with the naked eye. The compromise was to reduce the camera frame
rate down to between 5 and 10 frames per second, but even so quite a few of the screen effects
I tried just didn’t film well. One thing I did try was to trigger the camera
on each rotation of the disc and combine the images to create a perfectly synchronised
video but that’s a story for another day. If your going to build the pov I would recommend
using the 16Mhz pro mini which will improve the graphics performance and also at this
point I haven’t optimised the interrupt service routines. So thanks for watching, Please like, comment and subscribe And I will see you next time.


Add a Comment

Your email address will not be published. Required fields are marked *