Modelling the basics

A project log for Sous Vide cooker and more

A sous vide cooker built from a Raspberry Pi with Adafruit LCD and code generated from a state machine.

Richard DeiningerRichard Deininger 06/02/2015 at 13:550 Comments

As mentioned before, I want this project to be as modular and reusable as possible.

Because of this I made a quick detour to get more out of this.

I made a simple navigation program that uses the LCD and the buttons on the LCD plate.

Implemented functionality:

  1. Show the IP of the raspberry (no need for an external display,.. besides the LCD)
  2. A crude file explorer (only functions enter/exit folder and start another python script)
  3. Reboot system
  4. Shutdown system
  5. Exit program

All this was done with the help of a state machine and a python script code generator (lucky me,.. I work in a company that produces such software).

domain model with all classes

main state machine

Here you see the domain model with all classes needed and the main state machine.

The state machine consists of two "main" states the first is the "show menu" and the second "show cmd output".

The "root menu" has the above listed functions hard coded. Every command (besides "exit") is a simple shell command that gets executed and the return value will be stored inside a "cmdOutput" list.

This Output list will then be show inside the "show cmd output", this enables the state machine to show me the Raspberries IP (hostname -I) or give me the ability to scroll across a file list (ls -p -a).

With the help of the "Navigate" node I then can enter/exit folders and execute python scripts.

Navigating through the file list

entering or exiting a folder

The generated code

The last thing needed to run the state machine is a bit of code (hand written):

from LCDMenu import *
lcd = LCDMenu()

And here you can see it in action (the putty output shows the trace information from the state machine and the activies)