Protocol Specification >
For better mantainability of the code wedecided to split it in libraris.
Every library can be used on it's own.
This project require to:
-
display on a screen some analog reading, like temperature and humidity, a text message and the wagon number (WN in the following tables)
-
to allow the user to set the desired temperature for the wagon
To accomplished that we decided to go with a 2004 lcd display with the following screens:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | > | R | e | a | l | T | i | m | e | V | a | l | u | e | s | |||||
2 | C | o | n | f | i | g | u | r | a | t | i | o | n | |||||||
3 | ||||||||||||||||||||
4 | T | e | x | t | M | e | s | s | a | g | e | H | e | r | e |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | > | B | e | a | k | |||||||||||||||
2 | E | M | : | x | x | B | D | : | x | x | F | D | : | x | x | |||||
3 | C | T | : | x | x | , | x | x | T | T | : | x | x | , | x | x | ||||
4 | T | e | x | t | M | e | s | s | a | g | e | H | e | r | e |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | > | T | a | r | g | e | t | T | e | m | p | |||||||||
2 | B | e | a | k | ||||||||||||||||
3 | ||||||||||||||||||||
4 | T | e | x | t | M | e | s | s | a | g | e | H | e | r | e |
We created also some custom funcion to better manage those screens:
The LCD_Send comand is used to send single characters to the LCD.
Outside the library it's used only to move the cursor, inside the library is mostly used to send comands to the LCD.
void LCD_Send(char data, char mode)
The LCD_Write is used to send strings to the LCD, under the hood it uses the LCD_Send function but haveing a function that carry a string to the LCD by iterating it on it's own is easyer to manage.
void LCD_Write(char phrase[])
The nextone uses both of the previous comand to draw on the screen the 2 menu's option you can choose between.
void MENU_Page(char option1[], char option2[], char pointerLocation)
This comand is usefull to switch between the 2 menu's option.
Inside it you will finde we used the LCD_Send function to mek the pointer move acros the rows.
void MENU_Toggle()
The last comand is a comand used to react to the pression of the rotary encoder's knob.
char MENU_Enter()
You will find more information here.
Due to some problems arose on the physical board we had to switch to a simulator wich has some limitation such as the possibility to receive serial message while sendig.
This restriction kept us from developping a collision detection algorithm.
Switching to a simulator kept us also from implementing al the sensors and actuators that we had expected to use because it does not emulate them.
We decided also to generate random value to be able to send telemtry message to the RPI and so to the Cloud.