-
Notifications
You must be signed in to change notification settings - Fork 29
First steps
- Before anything else
- Differences between Arduino and panStamp boards
- Differences between current and old panStamp APIs
These are some important steps to follow before you start using your panStamps:
1- Install Arduino 1.6 IDE. This is the only IDE compatible with our latest libraries and core files. It is also the only IDE compatible with both panStamp AVR and panStamp NRG. If you want to use your old Arduino 1.0.x IDE you can still do it but only with panStamp AVR and our older "all-in-one" Arduino library documented in our old wiki.
2- Install the panStamp board files from the Arduino Boards Manager. You can follow this step by step tutorial.
4- Depending on your model of panStamp (AVR or NRG), you have to select the correct board from Tools->Boards. Then open any of the sample sketches and program your module. Each sketch is designed to provide different functionality. Some of them use the SWAP protocol and other don't. Before starting a new development, try to identify which of the available sample sketches better fits your project and try to understand the code. This wiki will try to help you along this process but you can also read our forums and post your questions to them.
Like Arduinos, panStamps include a programmable microcontroller. You can program Arduinos and panStamps from the same IDE but you still have to know the basic differences between these two architectures:
1- Arduinos are usually generic boards with a well-known pin-socket format and compatible with a long list of shields and child boards. panStamps are OEM modules with integrated low-power radio and designed to be used stand-alone or assembled onto mother boards with other sensors and/or actuators.
2- Arduinos and panStamps don't necessarily share the same position and amount of pins. There are even some differences between panStamp AVR and NRG, due to the inherent differences between microcontrollers (Atmega328p vs CC430F5137).
3- panStamps are low-current consumption boards made to last for years from simple batteries. They don't include an on-board USB front-end to save power and costs but they can be connected to panSticks or any other USB-(3.3V)UART converter.
4- panStamp doesn't load HardwareSerial by default so the Serial object used to print (print, println) our packets throuch the UART is not available unless you include HardwareSerial.h in your sketch. This technique prevents panStamps from wasting resources when Serial communications are not needed.
#include "HardwareSerial.h"
Users of panStamp's old library for Arduino 1.0.x will notice some changes in the current API. This changes have been introduced in order to match the current separation between core functions and libraries. This separation lets us, for example, share a common SWAP (Simle Abstract Wireless Protocol) library for both the AVR and NRG architectures. The following are the main differences introduced:
1- The panstamp object now has access to all the low-level functions and disassociates itself from the SWAP protocol. "basicradio" is the perfect sample sketch to discover how to use this object to do simple RF communications using your own packet format and protocol.
2- As of panstamp API version 2.0 (old API documented here) sketches must not call panstamp.init(). In case you want to set a different carrier frequency, open hardware/panstamp/arch/cores/panstamp/panstamp.h and change DEFAULT_CARRIER_FREQ accordingly. At the moment of writing this tutorial the following frequency values are available: CFREQ_868, CFREQ_915, CFREQ_433, CFREQ_918.
3- SWAP is now implemented as a separate library. You can load it by including "swap.h" in your project. This will automatically create an object called swap, which owns all the SWAP-related functionality.
#include "swap.h"
4- The swap object, only necessary if you want to use SWAP in your project, owns some of the methods before owned by the panstamp object. These methods were transferred to swap from panstamp given their close relationship with the SWAP protocol. Any of the sample sketches using SWAP will provide a rapid insight into these changes.