HsNet: Node communications for feature-limited microcontrollers

[Diego Spinola] wrote in to tell us about a node communication system he’s been working on called HsNet. The aim is to build a system of nodes that can be made up of small and inexpensive microcontrollers. The problem is that the least expensive controllers often don’t have a hardware UART. HsNet implements the RS485 protocol using a software UART along with a slim and sleek addressing scheme.

The first module developed, seen in the image above and video after the break, is a single channel pulse-width-modulation node using a PIC 12F683. It can be sent commands in the payload of the HsNet packet format. The PWM modules accept three different commands; one is a desired PWM value, another is a delay between steps for the PWM, and the last toggles a blink function.

He has also developed an analog sensor module and an Arduino-based TCP/IC gateway module. Now that the packet communications have been established, it will be rather simple to add nodes based on that groundwork. [Diego] brought these components together to build an interactive wall which can also be seen after the break.

PWM Nodes:

Wall artpiece:

Comments

  1. Grazz256 says:

    Out of curiosity, why define your own communications protocol rather then going with an industry standard such as modbus?

  2. @Grazz256: I did consider using modbus (RTU) for this particular project, however I wanted something that could be implemented by the simplest MCUs I could find , I just couldn’t guarantee some of modbus requirements(such as contiguous transmissions and CRC16 calc ) while still having enough flash/cpu time for the application itself.

    So I decided to create my own protocol focused on resource limited mcu’s that could be used over diferent physical layers.

    The next thing I’ll be going for in the next version is a multi-master setup (while maintaining the size/cputime restrains)

  3. zhanx says:

    anyone else think this sucker looks like a spinal
    cord?

  4. @zhanx the testing rig from the first video was really something “unique”
    A spinal cord that can drive ~48W per vertebrae!
    ;)

  5. Chris says:

    Diego, very interesting.

    One limitation of RS-485 is that you cannot implement star networks without hubs or repeaters. Each endpoint requires termination to reduce signal reflections; and with more than two terminators on a line, the load becomes too great.

    Do you think this could be adapted to implement a unterminated star network, which is able to ignore the signal reflections in software? That would be quite useful.

  6. Orthovia says:

    Well done Diego. Now you gave me a cheap solution to take sensor informations around my plant (by the way the diferential communication will avoid noise, right?).

    Orthovia

  7. HackerK says:

    Maybe I am still not fully awake, where is the circuit diagram?

  8. tantris says:

    how’s the hardware side of this? signal modulated on the power lines? separate serial lines? 1,2,pairs?
    does the discover protocol include a random wait and retry or are they all answering at once?

  9. @Chris : I haven’t tried unconventional topologies (other than the default 485 bus) but this is definitely something to be added to my TODO list

    http://www.hackeneering.com/Tiki/wiki/tiki-index.php?page=HsNetTODO

    @HackerK : sorry it was missing, but its a really intuitive rs485 physical layer ! you can check the PWM node schematics here (http://www.hackeneering.com/Tiki/wiki/tiki-index.php?page=SingleChannelPWMNode)

    @tantris : Hi there tantris, this implementation (the one in the wall artpiece) is using a really simple 1 twisted pair rs485 physical layer and a separate 12v power “bus”(the artpiece is power hungry ;). The discovery protocol was not ready as of the first release so all the nodes are currently being scanned (via unicasts). a discovery protocol using random exponential backoff is planned for the next version (together with the multi-master specs and a “AutoIp” like address distribution)

    Thanks you all for your time =) , I’m really happy that my project interests you guys.

  10. tantris says:

    @diego: if you are using a master-node, one idea (probably not original) would be a “last seen list”. on power-up the main node could call the other nodes that were there last time, and initiate discovery afterwards.

  11. m9dfukc says:

    hey, great stuff – I was researching to do this for myself until I found your project. Let’s see, maybe I’m gonna go and rebuild this with avr attiny mcu’s and keep your protocol definition.

    thanks :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,295 other followers