RE: Event triggered Sensor Nodes
"John Dammeyer" <[email protected]>
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I'm sending this again for two reasons. Didn't show up in what I'd consider
a timely period. And since it was sent as HTML I might get a response
tomorrow that the file is too large for the forum posting. So here it is
again without the HTML colourized text etc.
John
Collin,
No. Dont set all the fence node to one single ID.
It goes the other way around. Each node that transmits has a unique ID.
The logging node would be set up to receive all those IDs. The received ID
identifies which feed bin triggered the message. You can use an off the
shelf protocol for this. With less than 100 feed gages you fit into the
CANOpen world of 127 nodes. But its complicated and youd be chasing both
your application errors and the learning curve for CANOpen.
If you are just creating a simple data acquisition network where a lot of
features of the CANOpen/J1939/MilCAN/NMEA2000/DeviceNet HLPs are not needed
there are some simpler ways that wont get you into trouble. A number of
years ago I defined something I called the Modular Automation Protocol for
Controller Area Network. MAPCAN. Never went past various include files
and an article in Circuit Cellar magazine Issue 157, Aug 2003. But the
ideas are pretty straight forward and I did work with the MCP2510.
From the mapcan.h file included with the article are the CAN ID bit
definitions. The first couple of bits define the type of message. The next
bit describes whos sending it so there is some peer to peer capability as
opposed to only master slave. The last 8 bits define the sender ID. Theres
an enhanced version hat expanded to 29 bit IDs with sender and receiver in
the ID part along with a family or group mask.
In either case, you can set your logging module to filter to only receive
Device Messages for example. All gates or feeders are devices. The device
Rx filters are set to not receive device messages so they wont be
overwhelmed by the messages from the other nodes.
Its just one idea. With a pure master slave where a slave or device is
never allowed to send unless polled you have other alternatives.
Good luck
John Dammeyer
/* Definitions for the first two bits of a MAP/CAN message */
#define MAPCAN_SYSTEM_MESSAGE 0x000 // Similar to Interrupts on
processors
#define MAPCAN_DEVICE_MESSAGE 0x200 // Device Driver threads/tasks
#define MAPCAN_TASK_MESSAGE 0x400 // Application threads/tasks.
#define MAPCAN_FILE_MESSAGE 0x600 // Large block data commands.
/* The 3rd bit if the MAP/CAN ID is the Client/Server bit which determines
the
direction of the message. ie:
Bit == 0 then message to Server from Client (Thread to Device has high
priority)
Bit == 1 then message to Client from Server (Device response or status
has lower priority)
*/
#define MAPCAN_SERVER 0x100
#define MAPCAN_CLIENT 0x000
#define MAPCAN_TASK_BROADCAST_ID 0 // Global Broadcast ID.
/* Definitions for MAPCAN_SYSTEM_COMMAND messages
Source is in last 8 bits of ID,
0 is global for all devices and may only be issued by one node to
avoid collisions.
Destination Thread is first byte of message.
Command is in second byte of message.
System Command data starts at Byte 2
*/
#define MAPCAN_SYSCMD_DEST_INDEX 0 // Who for.
(0 is Global)
#define MAPCAN_SYSCMD_CMD_INDEX 1 // Offset to System
Command.
#define MAPCAN_SYSCMD_SYSDATA_INDEX 2 // System
Command parameters start here.
From: [email protected]
[mailto:[email protected]] On Behalf Of Colin
Watson
Sent: January-19-15 4:31 PM
To: [email protected]
Subject: [CANLIST] Event triggered Sensor Nodes
Hi,
Upon reading the MCP2510 data sheet, I am not sure how to set up a data
logging node to accept messages from about 100
sensor nodes being animal feed bin weighers triggered by animals entering
and leaving individual feed gates.
The feed fence nodes will transmit data to be read by a single node so I am
considering setting the arbitration field of all the
fence nodes to a common I.D. say 999 and to set the filters in the data
logging node to accept this I.D. as the entry to the
receiving buffer. The animal/feeder assignment can be part of the 8 byte
data frame to ensure animal feed consumptions
are recorded correctly.
Alternatively I could build a transmit code individual to every sensor node
but include a common bit segment to be selected
by the buffer mask.
The animal entry into feeders will of course be random and collisions will
be rare because of the fast CAN bus baud rate when
when compared to the randon animal behaviour - however collisions will
happen and I expect a queue until all coincident
data has been passed.
If the transmit I.D.s all have the same I.D. will bus arbitration work. I
think it should since the process simply waits for a
quiet bus.
My question is:
WHAT ARE THE BEST OPTIONS FOR SETTING UP A MULTI-SENSOR NODE COMMUNICATION
WITH A CENTRAL
DATA LOGGING NODE WHERE THE SYSTEM IS EVENT DRIVEN BY SENSOR DATA BECOMING
AVAILABLE ?
My experience with CAN bus is nil but it seems a good option for this
application.
An experienced comment would be immensely helpful.
Colin Watson. Edinburgh
--
Archives and useful links: http://groups.yahoo.com/group/CANbus
Subscribe and unsubscribe at www.vector.com/canlist/
Report any problems to <[email protected]>