Wireless Notice Board using SIM 300 and EK-TM4C1294XL

Well I just loved the idea of a wireless noticeboard which will display the notice whenever some sms is sent to it. That way you can intimate the concerned people about the notice or information even if you are not physically present at the location. This can be used in colleges wherein two notice boards can be installed per department. One will be used by the principal and the other may be by the head of dept. or the teachers. This is a quick way to send the info. So starting with the list of materials required.

Components

  • Micro-controller board with at least two hardware UARTs(not mandatory but will be beneficial.)
  • SIM 300 module or equivalent(with the charger etc.)
  • Some display e.g. LCD, dot matrix, graphical LCD etc.

Connections

connections

EK-TM4C1294XL Pins

TM4C129-X11-—-Pins-Maps

Code Explanation

The main objective is to extract the message from the received message. Now you can use some special character for this but I’ve decided to use the concepts of html tags. So my tag is <s></s>. Whatever is written in these tags will be displayed. String object provides beautiful string manipulation functions. So we will not reinvent the wheel but use it in our application so to speak. Let’s look at the code that will extract the message from the received data.

  char buffer[250];
  Serial.readBytes(buffer, 250);
  String message = buffer;
  String command = "<s>";
  String commandEnd ="</s>";
  int indexOfMessage = message.indexOf(command);
  int indexOfMessageEnd = message.indexOf(commandEnd);
  if(indexOfMessage>0 && indexOfMessageEnd>0){
  String actualMessage = message.substring(indexOfMessage+3,indexOfMessageEnd);
  Serial.print("Message             :");
  Serial.println(message);
  Serial.print("Command             :");
  Serial.println(command);
  Serial.print("CommandEnd          :");
  Serial.println(commandEnd);
  Serial.print("Actual Message      :");
  Serial.println(actualMessage);
  actualMessage.toCharArray(actualMessageArray,250);

We are making two strings command and commandEnd. These will store our tags. Next we need to find the index of these tags. For this we use indexOf() and this will return –1 if the string is not present. So we need to send the message only if both the indices are not –1.Next is just one toCharArray(), this is for the LCD function. Also the serial printing is just for our reference. You may remove those lines.

The scrolling part is taken from arduino cook book. Here is the link.

Thank you for reading this. If you liked this post do share it with others!!

Entire Code

#include <LiquidCrystal.h>;
LiquidCrystal lcd(42,44,49,50,70, 69);

const int numRows = 2;
const int numCols = 16;
char actualMessageArray[250];

void setup()
{
	  // put your setup code here, to run once:
	  Serial.begin(9600);
	  Serial7.begin(9600);
	  Serial7.println("AT");
	  while(Serial.available()>0)
	  {
		Serial.print((char)Serial.read());
	  }
	  delay(1000);
	  Serial7.println("AT+CMGF=1");
	  while(Serial.available()>0)
	  {
		Serial.print((char)Serial.read());
	  }
	  delay(1000);
	  Serial7.println("AT+CNMI=2,2,0,0");
	  delay(100);
	  while(Serial.available()>0)
	  {
		Serial.print((char)Serial.read());
	  }
	  delay(1000);
	  lcd.begin(numCols, numRows);
	  lcd.setCursor(0,0);
}

void loop()
{
  // put your main code here, to run repeatedly:
 if(Serial.available()>0)
 {
	  char buffer[250];
	  Serial.readBytes(buffer, 250);
	  String message = buffer;
	  String command = "<s>";
	  String commandEnd = "</s>";
	  int indexOfMessage = message.indexOf(command);
	  int indexOfMessageEnd = message.indexOf(commandEnd);
	  if(indexOfMessage>0 && indexOfMessageEnd>0){
	  String actualMessage = message.substring(indexOfMessage+3,indexOfMessageEnd);
	  Serial.print("message          :");
	  Serial.println(message);
	  Serial.print("command          :");
	  Serial.println(command);
	  Serial.print("commandEnd       :");
	  Serial.println(commandEnd);
	  Serial.print("actualMessage    :");
	  Serial.println(actualMessage);
	  actualMessage.toCharArray(actualMessageArray,250);
	 }
 }
  marquee(actualMessageArray);
  delay(1000);
  lcd.clear();
}
void marquee( char *text)
{
	int length = strlen(text); // the number of characters in the text
	if(length < numCols)
	lcd.print(text);
	else
	{
		int pos;
		for( pos = 0; pos <= numCols; pos++)
		lcd.print(text[pos]);
		delay(1000); // allow time to read the first line before scrolling
		pos=1;
		while(pos <= length - numCols)
		{
		lcd.setCursor(0,0);
		for( int i=0; i < numCols; i++)
		lcd.print(text[pos+i]);
		delay(300);
		pos = pos + 1;
		}
	}
}

Serial Monitor Output

notice board

Video

Tiva C Series TM4C1294 Connected LaunchPad

This launchpad features a Texas Instruments Tiva C series microcontroller. The core is ARM® Cortex™-M4-based. It features a TM4C1294NCPDT microcontroller with the following features.

Microcontroller Features

  • 120MHz
  • 1MB Flash
  • 256KB SRAM
  • 6KB EEPROM
  • Internal ROM loaded with TivaWare™ for C Series software
  • Cyclical Redundancy Check (CRC) hardware with 16-/32-bit Hash function that support four CRC forms
  • Support for four tamper inputs and configurable tamper event response
  • 10/100 Ethernet MAC
  • Ethernet PHY with IEEE 1588 PTP hardware support
  • USB 2.0 OTG/Host/Device with ULPI interface option and Link Power Management (LPM) support
  • Four Quad Synchronous Serial Interface (QSSI) modules with Bi-, Quad- and advanced SSI support
  • Ten I2C modules with four transmission speeds including high-speed mode

There is a library called TivaWare which give very useful functions to quickly program your device. The launchpad comes preloaded with a IoT program with which you can actually connect your board to the internet using ethernet cable. And as usual the cost is bare minimum.

Kit Contents

  • Tiva C Series Connected LaunchPad evaluation board (EK-TM4C1294XL PCBA w/ MCU)
  • Retractable Ethernet cable
  • USB debug cable
  • Read Me First instructions

CLP-Top_transparent_small_8bpp

Fig.1 Tiva C Series Connected LaunchPad evaluation board

Tiva_C_Series_Connected_Launchpad_Accessories_Large

Fig.2 Kit Contents

You can create many projects using this board. Following are the links for purchasing and reading about the board.

http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c1294xl.html#tabs

https://estore.ti.com/tiva-connected-launchpad.aspx