-----MSP430 Launchpad----
A Visual Basic 6 Based RF Greenhouse Controller

Step 0. Begin a cache of stuff for working with launchpad
...... and the TI zigbee RF modules
Step 1. Talk to me! Communicate to the MSP430 Launchpad
Step 2. Create and provide a web page for a general purpose programmer in VB6
that can be used to send commands to the controller

This is actually part of the greenhouse project shown elsewhere on this site. The idea is to create a web based controller for monitoring and regulating greenhuse function. The display would show temp. etc, the screen would allow password people to change greenhouse stuff. I could do the same with a hardware trip but it wouldn't be nearly so much fun. Now as most of you know I ama big PIC processor fan. But at $4/board, the MSP430G2 is too good an opportunity to pass up. So, I dove in, the first thing I discovered was the CCSS software has swolen a bit and now won't run on the older XP computer I'm typing this on, I needed over a gig of ram, and it's hard drive footprint now consumes 8gig of hard drive (what?). Now the reason I'm squeeking a bit the older versions were only a few MB. The MSP430, while low power and full of sensor wonders is essentially a 1970's style processor, and 1 or 2 kb is more than enough OS to set up the content of the MSP430, just sayin'! And the documentation could easily be from a 12th century monastery, sacred (you must sign the secret pact never to divulge, I divulge as often as I lie, frequently, so that was no problem...), voluminous, illuminated artistic (though only God knows where the pin diagrams and engineering specs were), tedious, methodical, and pretty much useless unless you were a rich landed baron in a foreign land with lots of PhD peons making car bombs.

Step one was then was to communicate. Instead of saying "Any RS232 software or dll will work", they hemmed and hawed, about 800 pages. Below is a picture of a simple VB6 interface. Since I couldn't use this computer with VB.Net, I did it with my laptop (lots of ram but 2 hours to load .NET. Here is a program to recieve temp into VB6 from the launchpad program. But since they failed to mention in set up that the data was a single byte of data, transmitted infrequently amid constant empty chatter, some time delay occurred as I dug through the Java code, about two hours. My wife has had a number of health problems, each day she says it's cold, it's warm, it's too.... I say "It's 74 degrees!" Imagine my surprise when the letter 'J' appeared. For as we now know the temperature in our house is a constant letter 'J', ascii code 74, yea!!!
So here it is:  www.gunstar1.com/tempecho.zip
The program uses the MSCOMM component available in references of VB6 as Microsoft and redirects the data to a second textbox
showing the temperature in centigrade as shown below:

Private Sub Command1_Click()
'Turn on or off using push button
 If MSComm1.PortOpen = False Then
   Command1.Caption = "Stop"
   MSComm1.PortOpen = True
'launch receive subroutine
   Call probie
   Command1.Caption = "Go"
   MSComm1.PortOpen = False
   Text1.Text = "---OFF---"
 End If
End Sub

Private Sub Form_Activate()
'Initialize the serial port....
While Val(cp) = 0
cp = InputBox("Comm Port#", "Com#", "3")
   MSComm1.RThreshold = 1
' When Inputting Data, Input 1 Byte at a time
   MSComm1.InputLen = 1
' 2400 Baud, No Parity, 8 Data Bits, 1 Stop Bit (set to same baud rate as Java Gui)
   MSComm1.Settings = "2400,N,8,1"
' Disable DTR
   MSComm1.DTREnable = False
' Open COM3 ===== Check Com port by opening devices in control panel/Yours may differ
  MSComm1.CommPort = Val(cp)
  MSComm1.PortOpen = True
' =================================
'launch receive subroutine
Call probie
End Sub
Sub probie()
'Recieve subroutine
While MSComm1.PortOpen = True
' If comEvReceive Event then get data and display
    If MSComm1.CommEvent = comEvReceive Then
      Data = MSComm1.Input 'grab byte if port active
      'Display Temperature
      If Data <> "" Then Text1.Text = Asc(Data): Text2.Text = Format((Val(Asc(Data)) - 32) * 5 / 9, "###.#") 'get data
     End If
     DoEvents 'Don't be too busy to check push button :-)

End Sub

Private Sub Form_Unload(Cancel As Integer)
'close the form
End Sub
Here is a picture of the comm component being selected in VB6. After selection it must be dragged onto the form (a little telephone, how quaint.).

Step 2. Create a GUI and a protocol for communication
Here is an initial GUI, basically just a shell but it has stuff. The communication would essentially consist of a series of commands to the msp430 as parsed text statements. Once an hour or more frequently the 430 would create a command table of 4 byte commands. Once a second the new commands would be posted, and on the half second, the processor would send back the actual 5 or 6 bytes, state of all lights, all valves, heat/cool, temp., light intensity at one point, water level at one point, maybe humidity. That data and the commands would be logged so that real vs. desired behaviour could be plotted.

Last Modified April 25, 2012