Go Down

Topic: Braille cells with Arduino (Read 1 time) previous topic - next topic

metec_ab

This tutorial shows you how to control braille cells with an Arduino Uno board. The speed of the pins can be controlled with a potentiometer on the analog pin 0.
Braille cells need about 200V. It is also possible to use your own power source.

You can see the YouTube Video here.
There is an other YouTube Video about a Braille E-Book Reader with an Arduino too.

See how to connect it


Code Example
Code: [Select]
//  Backpanel P20 with 5 braille cells
//  -----------------------------------------------------------------------------------------------             7 +200V  <-------------------------- DC-DC +185V
// |  cell 0   |   cell 1  |  cell 2   |  cell 3   |  cell 4   |  cell 5   |  cell 6   |  cell 7   | <-- Cable  6 n.c.
//  ------------------------------------------------------------------------------------------------            5 GND    <----   Arduino GND    ---> DC-DC GND
// |  1 oo 8   |  1 oo 8   |  1 oo 8   |  1 oo 8   |  1 oo 8   |  values of the pins               |            4 CLK    <----   Arduino pin 5
// |  2 oo 16  |  2 oo 16  |  2 oo 16  |  2 oo 16  |  2 oo 16  |                                   |            3 STRB   <----   Arduino pin 4
// |  4 oo 32  |  4 oo 32  |  4 oo 32  |  4 oo 32  |  4 oo 32  |                                   |            2 Din    <----   Arduino pin 3
// | 64 oo 128 | 64 oo 128 | 64 oo 128 | 64 oo 128 | 64 oo 128 |                                   |            1 +5V    <----   Arduino +5V    ---> DC-DC +5V
//  -----------------------------------------------------------------------------------------------                              Arduino pin 2  ---> DC-DC /ON
//
// YouTube video: https://www.youtube.com/watch?v=3zqth08wQBs
// P20 cell:      http://web.metec-ag.de/P20.pdf
// DC-DC:         http://web.metec-ag.de/DCDC%20Converter%205to200V.pdf
// Contact:       ab@metec-ag.de


const int ON     =  2;  // DC-DC Converter ON Pin. You can use it to switch off the cell power in a sleeping mode
const int DATA   =  3;  // Backpanel Pin 2 (Din)
const int STROBE =  4;  // Backpanel Pin 3 (STRB)
const int CLOCK  =  5;  // Backpanel Pin 4 (CLK)
const int POTI   =  0;  // Optional. There is an potentiometer on analog pin 0

const int cellCount = 8;
byte cells[cellCount];


void setup()
{
  pinMode(ON,     OUTPUT);
  pinMode(DATA,   OUTPUT);
  pinMode(STROBE, OUTPUT);
  pinMode(CLOCK,  OUTPUT);
 
  digitalWrite(ON, 0);  // 0=ON, 1=OFF
}


void loop()
{
  // left cell run all pins, next cell blinks and the others are running horizonal
  // Set the pins, send it and wait...
  cells[0] = 1;   cells[1] = 0;      cells[2] = 1+2+4+64;    cells[3] = 0;           cells[4] = 0;            Flush(); Wait();
  cells[0] = 2;   cells[1] = 255;    cells[2] = 8+16+32+128; cells[3] = 0;           cells[4] = 0;            Flush(); Wait();
  cells[0] = 4;   cells[1] = 0;      cells[2] = 0;           cells[3] = 1+2+4+64;    cells[4] = 0;            Flush(); Wait();
  cells[0] = 8;   cells[1] = 255;    cells[2] = 0;           cells[3] = 8+16+32+128; cells[4] = 0;            Flush(); Wait();
  cells[0] = 16;  cells[1] = 0;      cells[2] = 0;           cells[3] = 0;           cells[4] = 1+2+4+64;     Flush(); Wait();
  cells[0] = 32;  cells[1] = 255;    cells[2] = 0;           cells[3] = 0;           cells[4] = 8+16+32+128;  Flush(); Wait();
  cells[0] = 64;  cells[1] = 0;      cells[2] = 0;           cells[3] = 0;           cells[4] = 0;            Flush(); Wait();
  cells[0] = 128; cells[1] = 255;    cells[2] = 0;           cells[3] = 0;           cells[4] = 0;            Flush(); Wait();
}


void Wait()
{
  // optional. read the value from the poti on analog pin 0
  delay( analogRead(POTI) / 2 );
}




// Send the data
void Flush ()
{
  // This example is for one P20 backpanel. If you are using others you have to change the bit order!
  // P20: 6,7,2,1,0,5,4,3
  // P16: 6,2,1,0,7,5,4,3
  // B11: 0,1,2,3,4,5,6,7 
  // Rotate the bytes from the right side. Cell 0 comes first and is on the left position.
 
  for (int i = 0; i < cellCount; i++)
  {
    if ( bitRead(cells[i], 6) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 7) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 2) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 1) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 0) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 5) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 4) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
    if ( bitRead(cells[i], 3) )   {digitalWrite(DATA, 0);} else {digitalWrite(DATA, 1);}     digitalWrite(CLOCK, 1); digitalWrite(CLOCK, 0);
  }

  digitalWrite(STROBE, 1);  // Strobe on
  digitalWrite(STROBE, 0);  // Strobe off
}



Go Up