Braille Language In Raspberry Pi Using C# With Visual Studio

This article will help you in writing the code to your Raspberry Pi for a UWP using which you can apply the sequence of the alphabet that can be easily read by blind people. This language is called Braille language. Here, there will be six dots which will be touched and felt by blind people. For all the twenty-six alphabet letters in English, we have twenty-six different pattern types. These  patterns can be formed with the help of just six GPIO pins in Raspberry Pi. Before we get into this, let me explain a bit more about this language.

Braille language

Braille is a tactile writing system used by people who are blind or visually impaired. It is traditionally written with embossed paper. Braille-users can read computer screens and other electronic supports thanks to refreshable braille displays. They can write braille with the original slate and stylus or type it on a braille writer, such as a portable braille note-taker, or on a computer that prints with a braille embosser. The pattern for each alphabet for this language is shown in the image below.

 

Requirements

  1. Solenoid Actuator – X6 nos
  2. Jumping wires
  3. Relay – X6 nos
  4. Raspberry Pi

Creating UWP

Now, let us create a new UWP application. For this, open up Visual Studio and go to FileàNew ProjectàUniversal Windows Platform. This will create a new project. Now to make this application work with your Raspberry Pi, you need to add a reference file to your project. For this, right click on the reference files option in the solution explorer and then click on the add reference file option. This will show you a set of reference files. Now search for the reference file named “Windows IOT Extension for UWP” and add it to your project. This is the extension which you need to access your remote IOT device.

 

Writing code

We are going to use the pin numbers 5, 6, 13, 19, 26, 21. To make all these simple let us have these pins as following.

Pin 5 = a

Pin 6 = b

Pin 13 = c

Pin 19 = d

Pin 26 = f

Pin 21 = g

The code which we are going to write now is based on the conceptual pattern of the bailey language. Here we will be using six GPIO pins and one ground pin. For every different pattern we will be using different format of coding. Have a look over the image below to know about the patterns of the language. Look at the pattern of letter A. To make the pattern to work out, you need to make pin a high and rest of the pins namely b, c, d, f, g. I have shown the image of the pattern and the naming and pin numbers for the pattern.

 
Variables assigned to the Pins

Have a look at the code below. Just copy and paste the code in the main page to get the same output for the Braille concept. In the following code, I have written only for three alphabets. You just alter the code for the rest of the alphabets and numbers.

  1. using Windows.UI.Xaml;    
  2. using Windows.UI.Xaml.Controls;    
  3. using Windows.Devices.Gpio;    
  4.     
  5. // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409    
  6.     
  7. namespace Braille_Language    
  8. {    
  9.     /// <summary>    
  10.     /// An empty page that can be used on its own or navigated to within a Frame.    
  11.     /// </summary>    
  12.     public sealed partial class MainPage : Page    
  13.     {    
  14.         GpioPin a, b, c, d, f,g;    
  15.         public MainPage()    
  16.         {    
  17.             this.InitializeComponent();    
  18.             Loaded += MainPage_Loaded;    
  19.         }    
  20.     
  21.         private void MainPage_Loaded(object sender, RoutedEventArgs e)    
  22.         {    
  23.     
  24.             //pin opening    
  25.     
  26.             var controller = GpioController.GetDefault();    
  27.             a = controller.OpenPin(5);    
  28.             b = controller.OpenPin(6);    
  29.             c = controller.OpenPin(13);    
  30.             d = controller.OpenPin(19);    
  31.             f = controller.OpenPin(26);    
  32.             g = controller.OpenPin(21);    
  33.     
  34.             //setting pin mode    
  35.     
  36.             a.SetDriveMode(GpioPinDriveMode.Output);    
  37.             b.SetDriveMode(GpioPinDriveMode.Output);    
  38.             c.SetDriveMode(GpioPinDriveMode.Output);    
  39.             d.SetDriveMode(GpioPinDriveMode.Output);    
  40.             f.SetDriveMode(GpioPinDriveMode.Output);    
  41.             g.SetDriveMode(GpioPinDriveMode.Output);    
  42.             ////////////////////////////////////////////////////////////////////////////    
  43.             //Enabling Solenoid Actuator for letter A    
  44.     
  45.             a.Write(GpioPinValue.High);    
  46.             b.Write(GpioPinValue.Low);    
  47.             c.Write(GpioPinValue.Low);    
  48.             d.Write(GpioPinValue.Low);    
  49.             f.Write(GpioPinValue.Low);    
  50.             g.Write(GpioPinValue.Low);    
  51.     
  52.             ////////////////////////////////    
  53.             //Normal position    
  54.     
  55.             a.Write(GpioPinValue.Low);    
  56.             b.Write(GpioPinValue.Low);    
  57.             c.Write(GpioPinValue.Low);    
  58.             d.Write(GpioPinValue.Low);    
  59.             f.Write(GpioPinValue.Low);    
  60.             g.Write(GpioPinValue.Low);    
  61.     
  62.             ////////////////////////////////////////////////////////////////////////////    
  63.             //Enabling Solenoid Actuator for letter b    
  64.     
  65.             a.Write(GpioPinValue.High);    
  66.             b.Write(GpioPinValue.High);    
  67.             c.Write(GpioPinValue.Low);    
  68.             d.Write(GpioPinValue.Low);    
  69.             f.Write(GpioPinValue.Low);    
  70.             g.Write(GpioPinValue.Low);    
  71.     
  72.             ////////////////////////////////    
  73.             //Normal position    
  74.     
  75.             a.Write(GpioPinValue.Low);    
  76.             b.Write(GpioPinValue.Low);    
  77.             c.Write(GpioPinValue.Low);    
  78.             d.Write(GpioPinValue.Low);    
  79.             f.Write(GpioPinValue.Low);    
  80.             g.Write(GpioPinValue.Low);    
  81.     
  82.             ////////////////////////////////////////////////////////////////////////////    
  83.             //Enabling Solenoid Actuator for letter c    
  84.     
  85.             a.Write(GpioPinValue.High);    
  86.             b.Write(GpioPinValue.Low);    
  87.             c.Write(GpioPinValue.Low);    
  88.             d.Write(GpioPinValue.High);    
  89.             f.Write(GpioPinValue.Low);    
  90.             g.Write(GpioPinValue.Low);    
  91.     
  92.             ////////////////////////////////    
  93.             //Normal position    
  94.     
  95.             a.Write(GpioPinValue.Low);    
  96.             b.Write(GpioPinValue.Low);    
  97.             c.Write(GpioPinValue.Low);    
  98.             d.Write(GpioPinValue.Low);    
  99.             f.Write(GpioPinValue.Low);    
  100.             g.Write(GpioPinValue.Low);    
  101.     
  102. /*            The same way you just change the value of pins from high to low based on the patterns of the Braille language  
  103.             and write the code for the rest of the aplhabets and numbers                                   */    
  104.     
  105.     
  106.         }    
  107.     }    
  108. }  

Connecting the Raspberry Pi

Now, it is time to connect your raspberry pi with the Solenoid Actuator with the help of the breadboard along with the relay. I will simply explain the concept of connecting the Solenoid Actuator to the raspberry pi without the relay. But it is a must to connect the relay with the solenoid actuator to get an efficient output. Connect the pins as shown in the images below.

Execution

Once you finish the connection, connect the device to your application and then upload the program to your device. Since we have written the code of the alphabets in the sequence with a small delay in there, the alphabets will be executed at an interval of 2 seconds until the letter Z. Hope this will help you in creating an IOT based braille language app. Comment below if you find any difficulties in executing this.
 
Thanks for reading.


Similar Articles