Close

More serial fun..

A project log for ramanPi - Raman Spectrometer

The open source 3D Printable Raman Spectrometer using a RaspberryPi and easy to find off the shelf components..

flcfl@C@ 07/18/2014 at 07:570 Comments

So.. I have a pretty good working example going..  As it stands, I have the raspi commanding the controlBoard to check the laser temp, then check the cuvette temp, open the cuvette tray, close the cuvette tray and cycle through moving the filter wheel one rotation forward and then back...looping over and over just as a test...

Some quick pictures...

The controlBoard code for the command interpretation goes like this....(I couldn't fit this well using text)

The functional python (raspi) side is as follows....

and the command table looks like this...

Basically, the raspi builds a command like the following req_laser_temp command...

           req_laser_temp = (chr(0xF0)+chr(0xF2)+chr(0XC0)+chr(0xC5)+chr(0xF2)+chr(0xF3))

Which is:

[0xF0] [0xF2] [0xC0] [0xC5] [0xF2] [0xF3] 

or translated:

[packet_start] [packet_flag] [cmd_laser] [req_laser_temp] [packet_flag] [packet_end]

The controlBoard receives the command through the series of select satements a parses it out...it starts by receiving the packet_start, which moves to the next switch case for packet_flag..it sets the flag and starts a loop...and then moves to the next switch case...it receives the cmd_laser and moves to the next switch case and receives req_laser_temp...it does the temp check and sends the data...then continues in the loop...it receives the packet_flag, and moves to the next switch case and receives the packet_end which drops the flag and out of the loop...  waiting for another command..

I haven't added acknowledgments, or much else really.. but this is working pretty solid for the moment..

More tomorrow for sure..! (and of course... all of the code is available on gitHub right now...!)

Discussions