For years I thought I was working on technologies and product development. But recently I have looked back on my career only to realize that I may not be what I thought I was. In some form or another, I have always been a project manager.
I have been managing projects since before I graduated from college. Granted, many of the first projects were small in size, but they usually included managing budgets, schedules, resources, objectives and restrictions. As any Resident Assistant, Student Government leader can tell you, managing student projects or activities reveals to the organizer a lot about themselves to themselves. In my case it just didn’t sink in right away.
Sometimes I was leading the project, other times I managed only a portion of the project. In almost every project I was involved with, I would be the “go to” guy. This is not because I know everything there is to know (because I don’t), but rather I seem to know how to fill in the gaps. I know how take steps to get a project to completion. One of my clients likes to refer to me as the GSD guy (Get S#^% Done). Up to this point I have been fortunate enough to be able to exercise one of two options to maintain that title. One: find the appropriate person or company to perform the task, or two: teach myself the required skills to complete the task myself. This in and of itself is not necessarily a good thing. The better approach, is to have plan in place prior to reaching the requirement of getting the task finished.
As the people around me are already aware, I am not an emotionally charged person. I am not always very vocal. I tend to take in the situation and conditions before I begin to make decisions and take action. This trait seems to lead itself well to managing a project, where a number of issues could derail success. Having a plan, as well as alternative solutions, allows for quick reaction to changing situations. I had always considered this trait to be the most important for my designs and product development. But now I realize that it is even more critical for project management. Where I am not the sole developer, where teams of experts have to be brought into the project with aligned goals and time lines, this trait has proven the most useful. Where this trait is not very useful is during interviews and self-marketing. But that topic is for another post.
What is the punch line?
Not so much a punch line as it is a moral to the story. I suggest that from time to time, reflect back on your past experiences and how you handled stressful situations. You may find a common thread in all of your actions, roles, natural responses to reveal a side of you hidden from yourself. As someone close to me has recently discovered a natural talent to do business analysis, and market research, a hidden talent can be hard to recognize.
Using an Arduino to collect information from an array of sensors is an economical alternative to using a PLC when the data collection is not critical. In this post I will explain the basics of connecting the hardware of an Arduino to a C-More touch panel from Automation direct. I will then show a basic setting to allow MODBUS communication to work between the two devices.
Hardware you will need:
Arduino, in this case I used a Duemilanove:
RS232 to TTL converter:
Parts to make a rj12 to db9 connection. I actually used a serial cable cut in half and spliced into a RJ45 jack. You may want to consider a part like this:
Software you will need:
C-more programming software:
The Arduino IDE, I used version 1.01. At the time of writing this 1.03 is available.
The MODBUS library that I got to work with the C-more.
*note this library does not work with Arduino IDE prior to the 1.00 release.
Setting up the hardware.
Create the connector to convert the db9 connection to the RJ12 connection.
DB9 connections required are pin 2, 3,and 5. Pin 7 and 8 will not be used.
To make the RJ45 jack as I did connect make these connections.
DB9 — RJ45
Pin 2 – B4
Pin 3 – B5
Pin 5 – B2
When plugging in the RJ12 to the RJ45, be sure to center the plug in the jack.
###Edit adding Photo to show the intermediary cable.
( of course you can create your own DB9 to DB15 cable instead )
DB9 |–| DB15
Pin 2 – Pin 3
Pin 3 – Pin 2
Pin 5 – Pin 5
Connecting the Arduino with the RS232 to TTL DTE board
Then make these following connections:
Arduino |—| DTE
5V – VCC
Gnd – GND
Digital pin 0 – RX (Use a jumper wire or place a switch in the middle of this connection.)
Digital pin 1 – TX
Do not connect the RTS or CTS pins from the board to anything.
Configure the Software.
For the Arduino:
Place the MOBUS library into the Arduino IDE library. See this for more information on how to do that: http://arduino.cc/en/Guide/Libraries
You can also copy the MODBUSslave example into the example folder.
Launch the Arduino IDE.
Open the MODBUSslave example. ( from the example menu or by navigating to it in the MODBUS library folder.
Now connect to your board. Remove the jumper to the RX pin. ( or turn off the switch if you used one) This will allow the computer to communicate with the Arduino. If you forget to do this, the DTE board will interfere with the upload of the sketch.
Upload the Example to the board.
Once complete, reconnect RX to D0.
In the C-more software, Start a new project for the panel you have.
Go to Setup -> Panel Manager
Set PLC Protocol to Modicon Modbus RTU
Select direct connection
Set PLC SLAVE number to 1.
Baud Rate 9600
Stop bit 1
Control RTS No
Require CTS No
Select RS 485 No
Byte Order High Byte, Low Byte
Word Order Low Word, High Word
Character Order in register Char1, Char2
Registers per Message 32
Coils per message 64
Register Write Function Code 06
Coil Write Function Code 05
Time out 30
Poll time 3
Let’s place a Numeric Display on the screen,
In the Data Display tag open the tag database to create a new tag.
Click on Add
Select ARDUINO for the device name, Give the tag a name like ReadOnlyRandom.
Set it to Unsigned INT 16
Select memory type 3
Enter an address of 1
Click ADD, Select the new tag Click OK. (notice that the PLC address is shown as 30001)
Click OK again to assign the tag to the display.
Save and send the project to the C-more.
Connect the C-more to the Arduino using the com cable.
You should see LEDs on the DTE board flicker and a random number updating on the C-more screen. Congratulations, you have gotten past the biggest hurdle to getting a C-more to talk to an Arduino.
If you do not see this, check that you have RX and Digital pin 0 connected. Also try swapping the RX and TX connections.
Writing to an Arduino
Ok so now you can read from an Arduino, but how about writing to it.
Continuing with the example, let’s add a Numeric Entry in the same fashion as we did with the Numeric Display.
But this time when you add the new tag, Name it WriteableNumber with a memory type of 4 and an address of 9.
Save and transfer the project to the screen.
You should now see a 9 in the new entry.
Change the 9 to a different number. Now you have written to the Arduino.
To make use the register in the Arduino, update the example to use regBank.get(40009).
So in this post I covered how to setup the hardware to between a C-more touch screen HMI, and an Arduino. I also showed how to load the MODBUS library and example onto the Arduino. Lastly I showed how to configure the settings on the C-more to make use of the MODBUS RTU protocol in conjunction with the supported features of the Arduino.
The MODBUS library I used is not the only one available on the web, but it is the first one I got to work with a C-more.
Remember, when you are uploading to the Arduino, you must remove the RX connection.
In the next post, I will share a derived library that takes advantage of SoftSerial. This will allow You to connect the DTE board to Pins 2 and 3 instead of 0 and 1. There by allowing you to upload to the Arduino while remaining connected to the C-more.
Lastly I will share some methods to make it easy to read and write discrete bits using whole registers, instead of coils.
Please let me know what you think of this post. I welcome questions and feedback.
Windows Embedded Compact 7 has been updated with build 2816. This is the 13th update released. This update includes a major upgrade to Windows Embedded Silverlight Tools.
You can update Windows Embedded Silverlight Tools independent of Windows Embedded Compact 7, but it is generally recommended to allow Windows Embedded Compact 7 handle the upgrade for you. Simply let WEDU notify of you of the update, or launch the WindowsEmbeddedCompact7.exe installer from Add / Remove programs and select update.