Author Archive for ssmethurst

Simple serial client application, replacement for hyper terminal.

Hyper terminal is not included with the newest versions of Windows (Windows Vista-Win7).

As a replacement you can use one of these free tools

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

CAS BACnet Explorer: How to disable Read Property Multiple requests

Directions:

  1. Open CAS BACnet Explorer
  2. Open the settings dialog
  3. From the menu on the left hand side select “Preferences”
  4. Uncheck “Read property multiple” and click the “OK” button

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

CAS Gateway Firmware download tool

Instruction on how to upgrade the firmware on a CAS Gateway device 

  1. Download and install the CAS Gateway AutoUpdate tool from chipkin.com
  2. Connect the CAS Gateway Ethernet port to your network.
    • Ensure that the CAS Gateway Ethernet port ’link’ light illuminates, showing a connection to the network
  3. Connect your PC to the same network that the CAS Gateway is connected to.
  4. Run the CAS Gateway AutoUpdate tool
  5. Click “find” to discover the CAS Gateway on your network.
    1. Select the device from the list of discovered devices on your network and click ‘OK’
  6. Click “browse” and select the new firmware that you want to send to the CAS Gateway.
    • The firmware file should end “_APP.s19″
    • The firmware file should be at lest 2 mb in file size, probably closer to 3-5 mb
    • The firmware file should come from CAS. Do not upload any other firmware files with this tool unless explicitly told to by Chipkin automation systems support.
  7. Check the “Reboot when complete” check box.
  8. Click “Update”
    • The update may take a few mins to complete.
    • You will be presented with a conformation dialog on completion.
If you have any problems please feel free to contact Chipkin Automation Support for assistance.
Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

CAS Gateway IP address tool

Download

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Arduino + Ethernet shield, A better Webserver

The Arduino Ethernet Shield allows an Arduino board to connect to the internet. It is based on the Wiznet W5100 ethernet chip (datasheet). The Wiznet W5100 provides a network (IP) stack capable of both TCP and UDP. It supports up to four simultaneous socket connections.

The Webserver example sketch that comes with the Arduino IDE is is a great starting tutorial and should be at lest reviewed before reading this tutorial. The web server example sketch is  missing a few key features such as, the ability to respond to different GET requests with different response.

This tutorial assumes that you are using Eclipse as your editor for Arduino and you are familiar with both the Arduino and the Ethernet shield. This tutorial was created in response to VHS Hack challenge. You can download the Eclipse project for this tutorial from our website. Respond to different GET requests with different response source code.

When you request a page from the Arduino in your web browser, your web browser create a HTTP GET request. This GET request is sent to the Arduino’s where it gets processed and a response is formed and sent back to your web browser and is displayed to the user.

The GET request will look something like this

Hypertext Transfer Protocol
GET /helloworld.html HTTP/1.1\r\n
Host: 192.168.1.177\r\n
Connection: keep-alive\r\n
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1025 Safari/532.5\r\n
Cache-Control: max-age=0\r\n
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n
Accept-Encoding: gzip,deflate,sdch\r\n
Accept-Language: en-US,en;q=0.8\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3\r\n
\r\n

The first line in a HTTP GET request contains the requested file, in this example it is /helloworld.html. We can use this line to determine what page the user is requesting. The following function takes the request buffer and extracts the request string and stores it in a CWebserverRequest structure for reference.

bool CWebserver::ProcessHeader( char * requestBuffer, CWebserverRequest * request )
{
if( request == NULL || request == NULL ) {
return false;
}
sprintf( request->request_string, "/" );
// Get the request path.
char * get = strstr( requestBuffer, "GET " );
if( get != NULL ) {
get += 4 ;
char * eol = strstr( get, " " );
if( eol != NULL ) {
eol[ 0 ] = 0 ;
}
unsigned short length = strlen( get );
if( length > HTTP_MAX_REQUEST_LENGTH ) {
length = HTTP_MAX_REQUEST_LENGTH-1;
}
strncpy( request->request_string, get, length );
request->request_string[ length ] = 0 ; // NULL termanate the string.
}
return true;
}

We can user the request string later in our code to determine what page the user was requesting and respond accordingly.

More information

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Arduino, Where to get help

Arduino is an open-source, open-hardware,  electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

This links/help page was created in response to VHS Hack challenge.

Arduino IDE

You can download a free and open source Arduino IDE from Arduino.cc. It works pretty well and includes lots of example sketches to learn about the Arduino. Once you are comfortable with the basics you can upgrade to using Eclipse as your main IDE for Arduino.

AVRDude

AvrDude is the application that is used to download code to the Arduino and is included with the Arduino IDE and WinAVR. If you are having problems downloading code to the Arduino read this article from LadyAda.net on AVRDude.

Ethernet shield RAW packet

A Ethernet shield was created for the Arduino that supports TCP connections. I can be used to serve webpages of the current status of the Arduino among other things.

By default the Ethernet shield only supports TCP connections, but you can download Ethernet RAW library to support UDP and RAW packets. This Ethernet RAW library also fixes some of the bugs discovered in the default Ethernet libary shipped with Arduino IDE 015.

Help with your projects.

There are several different places to get help with your Arduino projects.

  • Arduino.cc Playground – Arduino code, circuit diagrams, tutorials, DIY instructions, tips and tricks
  • Arduino.cc Forms – A form to talk to other developers about all things Arduino
  • ladyada.net Learn Arduino – Ladyada website has more great tutorials.
  • Chiphacker – A Question and Answer website for chip developers that is useful for getting specifics information about a certain features in the Arduino chip (
  • StackOverflow –  A Question and Answer website similar to chiphacker that is useful for getting answers to programing related questions.
  • Atmega 168/328p data sheet – Can find an answer to your question anywhere else, check the chips data sheet.
  • Getting Started with Arduino, Making Things Talk – Are two great books filled with different Arduino projects and examples.

Project ideas

  • Make: Arduino – Make magazine is one of the forerunners for everything DYI. There website has lots of information and examples projects.
  • Instructables.com – Tones of example projects and tutorials for the Arduino.
Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Where are the debug files located – CAS BACnet Explorer

When sending support a bug report for CAS BACnet Explorer please include these three debug files.

  • C:\Users\<user>\Documents\CAS BACnet Explorer\Debuglog.txt
  • C:\Users\<user>\Documents\CAS BACnet Explorer\mstp_log.txt (If BACnet MSTP)
  • C:\Users\<user>\Documents\CAS BACnet Explorer\packets.pkt (If BACnet IP or BACnet Eth)

These files will help us tremendousness to find a solution to your problem. These files are plain text and they should compress down to 3-4mb with 7-Zip (free and opensource), or WinRar (free unlimited demo)

Packets.pkt can be opened with Wireshark.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

CAS BACnet Explorer – USB Key updater

The KeyUpdater.exe is an application at is used to update the USB product keys for CAS BACnet Explorer.

Directions:

  1. Extract the three files included in the Zip archive to a temporary directory (C:\temp\)
  2. Run the ‘KeyUpdater.exe‘ application
  3. Insert the USB product key, It should look similar to this. A green LED should illuminate if property connected.
  4. Click the “Update Key” button

If the key was updated correctly you should get a dialog that says “Done”

This error message can happen for the following reasons.

  • The USB key is not plugged in. Please ensure that the USB key is plugged in and the internal LED is illuminated.
  • The wrong USB key is used. The USB product key looks like this. Ensure that you are using the correct USB key.
  • The USB key is plugged in to a USB hub that does not have enough power to program the USB key. Plug the USB key directly in to the PC.
  • The applcation is missing the two included DLLs. This application requires two DLLs included with the application to run property.
  • The application is run from with in an Zip file instead of a temporary directly. Some Zip application do not extract all the files from a archive before running the EXE. extract the files to a temp directory before attempting to run this applications.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

How to change the default BACnet port (47808) in CAS BACnet Explorer

Question: How to change the default BACnet port (47808) in CAS BACnet Explorer?

Answer: You can change the default BACnet port for CAS BACnet Explorer in the settings dialog. The default BACnet port is  47808 or 0xBAC0 (HEX)

Note: You can change the default port that wireshark uses to detect and decode BACnet messages. See this artile for more information Monitor any port using any protocol with Wireshark

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Using Eclipse with Arduino Duemilanove

The Arduino IDE is good for simple projects, but as soon as you start building more complex multi file projects it just not up to the job. Eclipse on the other hand is free, powerful, and full-featured development environment that can be set up to work with AVR and Arduino. Arduino’s website has some decent instructions on how to compile with Eclipse for Arduino but its has some missing/confusing steps and is meant for C development not C++. It still has some good reference material that you should review.

In this tutorial we will be showing you how to set up the eclipse environment, Build the Arduino library, Create a Arduino project, Compiling C/C++ code, Uploading code to the Arduino, FAQ. This tutorial was created in response to VHS Hack Challenge.

Setting up the Eclipse environment

Download
You may not be able to find the exact versions that are used in this tutorial, just you the most updated versions.

Installation
  • Install Java runtime. Most computers will already have Java installed as it is used for many other applications.
  • Install Arduino software. The Arduino software comes with the Arduino library and source code examples that will be useful when developing your own projects.
  • Install Eclipse. This should be pretty straight forward. You can install Eclipse in any directory you want. For this tutorial we installed it in C:\Dev\eclipse-cpp
  • Install WinAVR, You can install WinAVR in any directory you want. For this tutorial we installed it in C:\Dev\WinAVR-20100110
  • Install Eclipse AVR plugin. You will have to manually copy this “plugin” into the the Eclipse installation. Move the folder which begins with the name “de.innot.avreclipse” to the “dropins” folder located within the eclipse folder. Restart Eclipse if you have it already running. There should now be a new “AVR” toolbar button in your workspace.

Build the Arduino library

Before we can create our first Arduino project we have to link in the Arduino library for Eclipse. There are several different ways of doing this described on Eclipse for Arduino tutorial but for this tutorial we will be creating a static library.

You can download the project and the library directly and skip this step.

  1. Open Eclipse and start a new C++ project.
  2. C++ Project
    • Project Name: ArduinoCore
    • Project Type: AVR Cross Target Static Libary
    • Toolchains: AVR-GCC Toolchain
  3. Select Configurations, Uncheck debug we will not be using the debug version of this library in this tutorial.
  4. Set the MCU type and frequency for your Arduino board. For example, for the Diecimila, use ATmega168 running at 16000000 Hz. For new versions of the Duemilanove, use ATmega328P running at 16000000 Hz. If you look closely at the Arduino board, you can see the target platform written on the main processor. Click Finish.
  5. In Eclipse, click Project->Properties.
  6. Select C/C++ Build and expand the category (e.g., click the diamond to the left of “C/C++ Build”).
  7. Select Settings under C/C++ Build.
  8. In the right pane, Click AVR Compiler
    • Debugging. Set “Generate Debugging Info” to No debugging info.
    • Optimization. Set the Optimization Level to “Size Optimizations”.
    • Directories, Add the path to the Arduino IDE’s Hardware folder “Arduino-0018\hardware\arduino\cores\arduino”
  9. In the right pane, Click AVR C++ Compiler
    • Debugging. Set “Generate Debugging Info” to No debugging info.
    • Optimization. Set the Optimization Level to “Size Optimizations”.
    • Directories, Add the path to the Arduino IDE’s Hardware folder “Arduino-0018\hardware\arduino\cores\arduino”
  10. Right click on the ArduinoCore project in the project explorer on the right and select Import.
  11. On the Import dialog, select General => File System and click next.
  12. On the File system dialog click browse and select the Arduino IDE’s hardware folder  “Arduino-0018\hardware\arduino\cores\arduino”
  13. Select all the files except main.cpp. Click finish
  14. Build the project, On the mail dialog click the hammer in the too bar or by selecting Project =>Build All.

Congratulations you have created the Arduino C/C++ library for Eclipse.  The library ( libArduinoCore.a ) can be found in the projects release folder. It should be around 26k

Path: \workspace\ArduinoCore\Release\libArduinoCore.a

Creating a Arduino project

Now that we have the Arduino library we can build our first Arduino project. We are going to start with the Blink tutorial from Arduino.cc its one of the simplest tutorials and should be a good building block for future projects.

You can download the project for this tutorial from our website.

  1. Create a new Eclipse C++ project, File => New => C++ project
  2. C++ Project
    • Project Name: Blinky
    • Project Type: AVR Cross Target Application => Empty project
    • Toolchains: AVR-GCC Toolchain
  3. Select Configurations, Uncheck debug we will not be using the debug version in this tutorial.
  4. Set the MCU type and frequency for your Arduino board. For example, for the Diecimila, use ATmega168 running at 16000000 Hz. For new versions of the Duemilanove, use ATmega328P running at 16000000 Hz. If you look closely at the Arduino board, you can see the target platform written on the main processor. Click Finish.
  5. In Eclipse, click Project =Properties.
  6. Select C/C++ Build and expand the category (e.g., click the diamond to the left of “C/C++ Build”).
  7. Select Settings under C/C++ Build.
  8. In the right pane, Click Additional Tools in Toolchain
    • Check Generate HEX file for flash memory
    • Check Print size
  9. In the right pane, Click AVR Compiler
    • Debugging. Set Generate Debugging Info to “No debugging info”.
    • Optimization. Set the Optimization Level to “Size Optimizations”.
    • Directories, Add the path to the Arduino IDE’s Hardware folder “Arduino-0018\hardware\arduino\cores\arduino”
  10. In the right pane, Click AVR C++ Compiler
    • Debugging. Set Generate Debugging Info to “No debugging info”.
    • Optimization. Set the Optimization Level to “Size Optimizations”.
    • Directories, Add the path to the Arduino IDE’s Hardware folder “Arduino-0018\hardware\arduino\cores\arduino”
  11. In the right pane, Click AVR C++ Linker
    • Command: avr-gcc
    • Command line pattern: ${COMMAND} –cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS} *NOTE — is two short dashes (- – with out the space) not a single long dash, WordPress auto converts two short dashes to a single dash
  12. In the right pane, Click AVR C++ Linker => Libraries
    • Add your Arduino library created above “ArduinoCore“, The name of the library does not include the extension or the pretext of ‘lib’.  Note: In this project I copied the library in to the base folder of the Blinky project for simplicity.
  13. Create a new source file,  File => New => Source file, Call it main.cpp
  14. Copy the contents of this file main.cpp in to main.cpp
  15. Build the project, On the mail dialog click the hammer in the too bar or by selecting Project =>Build All.

Uploading code to the Arduino

Lucky there is already a tool for this built in to AVR plugin for Eclipse called AVRDude. It should already be included with the AVR plugin for Eclipse so you shouldn’t have to download or install anything else.

  1. In Eclipse, click Project =>Properties.
  2. On the left hand side AVR => AVRDude
  3. You will need to create a new programmer configuration for your board but you only have to do this once.  Click New
  4. New programmer configuration
    • Configuration Name: Arduino Duemilanove
    • Programmer Hardware: Atmel STK500 Version 1.x Firmware
    • Override default port: //./COM14
      Note:  you will have to change this to your comport.)
    • Override default baudrate: 57600
  5. Click OK,
  6. On the AVRDude dialog select Advanced
  7. Check “Disable Device signature check” and click OK
  8. Highlight Blinky in the project explorer and click AVR => Upload to target device or the AVR icon with the green downward arrow.
  9. The results will be printed in the console.

Launching C:\Dev\WinAVR-20100110\bin\avrdude -pm16 -cstk500v1 -P//./COM14 -b57600 -F -Uflash:w:Blinky.hex:a
Output:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATMEGA16 is 1E 94 03
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file “Blinky.hex”
avrdude: input file Blinky.hex auto detected as Intel Hex
avrdude: writing flash (1158 bytes):

Writing | ################################################## | 100% 0.61s

avrdude: 1158 bytes of flash written
avrdude: verifying flash memory against Blinky.hex:
avrdude: load data flash data from input file Blinky.hex:
avrdude: input file Blinky.hex auto detected as Intel Hex
avrdude: input file Blinky.hex contains 1158 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.52s

avrdude: verifying …
avrdude: 1158 bytes of flash verified

avrdude done. Thank you.

Congratulation you have uploaded your source code to the Arduino.

FAQ

Q: I keep getting this error message when I upload code with AVRDude to the Arduino.

avrdude: stk500_getsync(): not in sync: resp=0×00
avrdude done.  Thank you.

A: Disconnect and reconnect your Arduino and try again

More help

For more help with setting up Eclipse to work with Arduino see these two posts on the subject

If you have any other questions or suggestion on how to improve this article, please leave a comment.

Update:

DubiousTech:
First error I got was with the linker command line pattern. I got a compiler error “avr-gcc.exe: –cref: No such file or directory”. It looks like the “–cref” should be “–cref”. After changing that I got a different error saying “ld.exe: cannot find -lArduinoCore”. Eventually, after trying just about everything I could think of I discovered that I needed both the name of the library in the “-l” box and the file location in the “-L” box. This might very well be a simple mistake, but it’s not clear to a novice.

Steve:
You’ve got to update this post so the dash in front of “cref” is actually two dashes

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have



Pages