Panstamp for dummies

182 views
Skip to first unread message

Iulian-Marius

unread,
May 19, 2012, 9:27:42 PM5/19/12
to panstamp
Just keep trying for a while to find the time and knowledge/
understanding to do more with Panstamps. Tested most of the example
sketches and played a bit with Lagarto & Lagarto -Max : great tools,
well thought and organised! Thank you Daniel for all your hard
work!!!!! As will be a shame to use all this just for some simple
enviromental monitoring, tried to do more with a certain degree of
success (small :) ). With Daniel's help and help from the other
members I've made a first attempt to my Panstamp Hydroponic
Controller. Lack of time stopped me for a while, now back to basics,
hence this post.
Lets take for example an AlwaysOn Panstamp with a DHTxx sensor, a LDR
and 2 relays connected to it (a relay board with 2 individual relays
connected to 2 different pins on Panstamp).
This node reports data to a PC with PanStick (modem.ino) and Lagarto
running on it.
The node has to report data every X minutes, listen for incoming
commnads and querries and run few operations independentely.
If the node reports data every 5 min (plus when command or querry
received), it has to read the sensors and adjust the relay status at a
higher frequency that once every 5 min, let's say every 10seconds. If
sensors are pulled every 10 sec and relays changed accordingly, in
order to reduce network traffic and risk of collision dont want the
data to be sent after each reading. this excludes calling
"getRegister(REGI_SENSOR)->getData(); " to perform readings. Is that
correct??
Can another function be called to read sensors and depending on
results to decide if data needs to be reported? Example#1: if
previousTemp 0.5C higher or lower than currentTemp - update registers
and report data; Example#2: if relayOneCurrentStatus !=
relayOnePreviousStatus - update registers and report data;
I know that can be done, question is how will affect the overall
performance of the node? Will be a better solution to report every 10
sec ?
Maybe I should stop here for the moment and get some feedback/answers
first,not sure that my "processor" can take more than this at
once :) .

Daniel Berenguer

unread,
May 20, 2012, 6:06:07 AM5/20/12
to pans...@googlegroups.com
Hi Iulian, your processor is fine, just don't overclock it ;-)

Updating internal values without transmitting statuses is perfectly possible:

1. Read your sensors periodically, using a timer or directly from
loop(). Update your registers from your own "readMySensor" function as
you usually do from the updater function.
2. When declaring your register, set the updater function to NULL
since you no longer need to manipulate values whenever
getRegister(REGI_SENSOR)->getData() is called:
REGISTER regSensor(dtSensor, sizeof(dtSensor), NULL, NULL);
3. From your custom "readMySensor" function, you can transmit a SWAP
status simply by calling getRegister(REGI_SENSOR)->getData()

As a side note, SWAPmaker will be released next week. I'm aware of the
difficulties of understanding how to code new sketches so I decided to
develop a wizard which does most of the work, including the creation
of the necessary xml files.
Reply all
Reply to author
Forward
0 new messages