# Need help with 2X3 matrix for braille

I'm an intermediate Arduino progammer, and I'm making an electronic braille display for my friend. You can think of this display as an array of 28x3 LEDs(one braille character contains a maximum of six (2x3 for one letter) dots so there can be 14 characters displayed at a time, including spaces) but actually instead of LEDs, there will be electrical braille cells. This will be the algorithm:

1. Read string (English alphabet) files from SD card
2. Count the letters, including spaces, until it becomes 14. Convert them into braille (2x3 for one letter) and then display them (as we will be able to display only 14 letters at a time )
3. When the user presses the button for the next row/page do the same process(step 2) for the next string.

So this is the complete process I want to do.

I have 5 months deadline to make it. The main problem is how I can make the code to convert and then display it. I know there are already a lot of Arduino libraries out there for displaying stranded English characters, but this is different, because I'm new to Arduino and 'C'.

Instead of losing your mind and saying this site is not for fool people like you, please guide this 17yr old what should I learn in order to make this for my friend who lost his eyesight in an accident(consider I have time of 5 months).

Do I have to build entire new Library for converting alphabet and multiplexing braille? Or is there existing code that will work.

• Do you have a conceptual prototype in a language you do know? Sep 21, 2016 at 13:45
• no this will be the first time Sep 21, 2016 at 13:47
• Well, that would be a good starting point. Sep 21, 2016 at 14:18
• Why would you want braille on a display? Doesn't that defy the purpose of braille itself? Anyway, Arduino is capable of recognizing characters in an array. You simply then need to check which char it is, then display the associated dots. I suggest googling some of these things: read sd card string to char arduino, or something like this. Then find a tutorial for a display and start writing the code for only 1 letter. This way you can check if it works, if it does you can make the code for all the other letters and punctuation.
– Len
Sep 21, 2016 at 14:46
• A lot of display libraries have a way to define custom font. Just create a font that shows braille dot Sep 21, 2016 at 18:09

First of all, may I say "Thank you" for helping your friend like that? I cannot think of a better way to use an Arduino than as a driver for a Braille display like you describe!

As you know, Braille is a representation of characters into a "shape" that many systems don't recognise. Most people only encounter Braille when they press a button on an elevator or an ATM and see raised dots. Nevertheless, this is MUCH easier than the system that deaf people use: they represent whole words with a hand gesture.

I hereby challenge EVERY reader of this post to enter an elevator, or look at an ATM, and notice (and decode!) the Braille dots on the buttons. Elevators for some reason use the double coding "`#1`", "`#2`", "`#3`" etc. (as described in the question's graphic) when it is clearly unnecessary - of course you want to press a floor number! ATM buttons just use the 'raw' number pattern.

Because in Braille each character is converted into its own representation, you can do a VERY simple conversion. If you think about it, it is happening in computers trillions of times a day: when a computer converts a keypress into a set of pixels that represent the character on a computer screen. Your "pixels" are just a WHOLE lot simpler than the 5x7, 13x15 or font-specific conversion for the characters that normal-sighted people see.

The first thing that you need to do is define a system that converts the 2x3 array into an array of bits. Why? To make storage easier. I'm going to represent the Braille cell with a set of digits from `0` to `5`:

`````` 0   1
2   3
4   5
``````

Why? Because it is then possible to "compress" the representation into a single byte of data. If you know computing well enough, you know that it runs in binary, and each digit above can be represented in a single bit, numbered 0-5.

Thus `A` is represented by raising the top left pin, which is the same as bit `0`: which can be represented by the byte `B000001` or `0x01`:

``````X .
. .
. .
``````

Of course a space, with nothing raised, would be represented by `B000000` or `0x00`.

You may not know this, and most computing people wouldn't either: the next "obvious" encoding (for `B`) would be `B000010` or `0x02`:

``````. X
. .
. .
``````

But a blind person would have a serious difficulty in decoding this, since in isolation (no way of interpreting the "down" pins) it would look exactly like an 'A'. So the fact that 'B' is encoded as:

``````X .
X .
. .
``````

means that the binary encoding would be `B000101` or `0x05`.

As a further example, the character 'I' would be

``````. X
X .
. .
``````

or the byte `B000110` or `0x06`.

I'm not going to convert every character, but I hope that this explains things well enough for you. By giving every character its own bit pattern, you can then convert any possible string into a set of bytes for conversion by your library.

Only... there's a problem. With Braille, you need to convert numbers `0` to `9` into a special pattern. Because Braille only has 6 'bits' to choose from (and even then not every combination is "nice" for blind people to read), there is a special "flag" character to say "the following characters are digits!" (and a pattern to say "OK, back to normal letters again").

This means that there is not a one-to-one translation between an English string of characters, and the resultant string of bytes to represent those characters in Braille: you need to add extra "convert" bytes to the process. Of course these "convert" bytes can also be represented by the same bitmap as described above:

``````. X
. X
X X
``````

is equal to `B111010` or `0x3A`.

That means that it is possible to write a function to convert a series of ASCII characters into a series of Braille bytes: you just need to provide more bytes than the string converts! This also means that you may need to use less than 14 characters from the source before you run out of room on the display...

I would love to give you my address for more help: I'm afraid that StackExchange won't let me post my e-mail address!

• The elevator buttons being marked with '#1', '#2', etc could be to distinguis between say the 'Bottom/Basement' floor and the '2nd' floor.
– TwoD
Sep 23, 2016 at 16:22
• @TwoD That makes sense! Very few elevators here have anything but numbers. I do remember seeing all sorts of things in the US - "Mezzanine", "Banquet", etc - although I don't remember the Braille (if any) those buttons had. Sep 24, 2016 at 6:31

Each character will be 6 bits (so let's use a byte to store it) and we'll use the following bit to LED mapping

``````bit0   bit1
bit2   bit3
bit4   bit5
``````

Now you just need an array of bytes where each byte signifies an ASCII character. Your code will get the letters to display and for each one will do something like this:

``````byte BrailleBytes[] = {0x01, 0x05, 0xD, etc etc}; // only done the first 3 chars

byte getBrailleForCharacter(char c)
{
int index = asc(c) - asc('A');
return BrailleBytes[index];
}
``````

The key to decoding it this way is to make sure you sequence your bytes in BrailleByte the same way the ASCII table does - so if you want punctuation/numbers etc then you'll have to start lower and adjust the `asc('A')` accordingly

Now you have the byte it is just a case of checking what bits are set and turning on the relavant LEDs.

• thank you very much for answering my queries, considering I'm a beginner in arduino programming, is there any book which is specifically designed for arduino programming which can help me learning or should I just focus on normal C programming courses so that I'll be able to understand and build complex codes? Sep 21, 2016 at 16:52
• arduino.cc is probably the best place - lots of tutorials available. Sep 22, 2016 at 8:37