ab500
Posts: 4
Joined: Wed Dec 19, 2012 11:06 pm
Location: Seattle, WA
Contact: Website

Raspberry Pi as an 802.15.4 Basestation

Wed Dec 26, 2012 4:56 am

Hey Everyone,

I've been working on building a kernel module for the Raspberry Pi to let it interface with an 802.15.4 radio (the CC2520).

The eventual goal is to get it running a full 6LoWPAN network stack and act as a wireless mesh network router, bridging low-power sensor networks of mesh-networking motes with traditional IP networks.

Right now the driver supports sending and receiving and exposes itself as a character driver with some ioctls for radio configuration. Testing shows that it can saturate the radio with data and achieve really low latency communication.

The code is pretty nifty because it shows what kind of timing guarantees one can get with a little bit of effort and by writing a kernel module. It also is a really good example of how to write a spi protocol driver, which should be really useful for anyone trying to do something similar.

Anyway, I'll be continuing to hack on this over the next few months. Basic sending/receiving is there, but a lot of layers need to be built on top of that to get it to a usable application-level protocol. If anyone is interested in testing it out I'd be happy to help and answer questions. If there's enough interest I could get some hardware put together, right now I'm using an evaluation module for the radio and an interface PCB we designed. The code is available on GitHub here:

https://github.com/ab500/linux-cc2520-driver

The documentation is a little spare at the moment as the project evolves!

simonpb1
Posts: 25
Joined: Thu Sep 13, 2012 11:25 am

Re: Raspberry Pi as an 802.15.4 Basestation

Tue Jan 08, 2013 5:04 pm

Hi
I am looking at using the Pi has a border router for a 6lowpan network. Using the jennet-ip stack with a dongle plugged into the usb port.

I have this working to the point of switching on/off an LED on an evaluation board using a bit of php and python.

My next job is to make a fully functioning Home automation server. I have just started looking into CoAP which stands for Contrained Application Protocol which enables simple electronic devices to communicate over the web. A bit like SoAP I think.

ab500
Posts: 4
Joined: Wed Dec 19, 2012 11:06 pm
Location: Seattle, WA
Contact: Website

Re: Raspberry Pi as an 802.15.4 Basestation

Tue Jan 08, 2013 7:45 pm

Hey,

We're on the same wavelenght, I think what I'm building is a little more advanced than what you described however.

We're going to support a full 6lowpan stack as well, along with a RPL implementation for multihop message delivery, the standards IPv6 low-power routing protocol.

Take a look at the set of services TinyOS provides, it should give you a good idea of what I'm trying to accomplish. The Raspberry Pi will act as a border router for a 6lowpan/rpl network. I've gotten the CC2520 radio working with extremely low latency using the kernel driver. I've also almost finished implementing software acknowledgements, low-power listening compliant transmissions, and csma/ca backoff algorithms. I've been working on an adaption layer that will allow the networking stack found in TinyOS, which typically runs on embedded AVRs and MSPs, to run in user-land and access the radio.

The end goal is a really nice base station that can receive and transmit to battery or solar-powered motes that can run for years and years on a single battery. All completely open source.

I really want to focus on making this technology available to hobbyests. I've worked in an embedded wireless sensor network lab for the past few years, and getting this stuff in the hands of the masses is really important to me.

If there's enough interest I can make hardware available (a radio interface board for the Pi and maybe some embedded motes with temp/rh and gpios available) for more or less the manufacturing cost!

simonpb1
Posts: 25
Joined: Thu Sep 13, 2012 11:25 am

Re: Raspberry Pi as an 802.15.4 Basestation

Wed Jan 09, 2013 1:12 pm

Are you planning on running a web server on the router. To provide an interface,scheduling etc to the RF Nodes?

ab500
Posts: 4
Joined: Wed Dec 19, 2012 11:06 pm
Location: Seattle, WA
Contact: Website

Re: Raspberry Pi as an 802.15.4 Basestation

Wed Jan 09, 2013 6:29 pm

It will run a web server, the primary purpose of which is to view routing information, other important metrics for WSNs, see packet data for debug, and perhaps as a CoAP client.

Scheduling for motes is generally baked into the MAC layer. Low power listening allows for motes to achieve pretty low latency transmission, while still keeping power consumption low. There are alternative MAC strategies but for a general purpose WSN supporting many-to-one, one-to-many, and any-to-any messaging patterns LPL with RPL for message routing is a really solid approach.

It's not going to be the typical "WiFi Arduino Temperature Sensor". I'm building a high-performance, low power consumption implementation that should be usable for really serious deployments.

simonpb1
Posts: 25
Joined: Thu Sep 13, 2012 11:25 am

Re: Raspberry Pi as an 802.15.4 Basestation

Wed Jan 09, 2013 10:40 pm

It would be nice to see it working then.
I am looking to provide more in terms of just monitoring temperature. Like you I am looking to build a serious gateway for a whole range of purposes.

Like you I think the hobbiest building home automation systems would be interested in this sort of thing but I am more interested in the end devices such as shade control systems and lighting systems.

I am using the jennic chips as they out perform many of the other wireless chips and have many more peripherals integrated on chip. Many of the other wireless chips need to have an host processor and that is where the jennic chips some into there own.

Good Luck

User avatar
cyrano
Posts: 717
Joined: Wed Dec 05, 2012 11:48 pm
Location: Belgium

Re: Raspberry Pi as an 802.15.4 Basestation

Wed Jan 09, 2013 10:58 pm

Could a project such as Airmesh be of any help?

http://www.netlore.co.uk/airmesh/?page=home

ab500
Posts: 4
Joined: Wed Dec 19, 2012 11:06 pm
Location: Seattle, WA
Contact: Website

Re: Raspberry Pi as an 802.15.4 Basestation

Thu Jan 10, 2013 5:32 am

cryano:

Airmesh is certainly interesting, but a little different than what the goals of this project are. Airmesh strives to create a mesh network to protect free speech that operates over many, many computers. We're just interested in creating a house full of networked, inexpensive sensors and actuators.

simon:

Jennet is nice looking, but be a little weary. It's proprietary and not standards based. If that's alright with you then carry on, I'm a little more focused on ensuring that the whole stack is operating on standards-compliant protocols and open-source implementations. They provide multihop routing (meshing) using a proprietary and undocumented set of protocols. The IETF has created RPL for that very goal and it will interoperate with all compatible implementations.

The stm32w series of chips are also ARM-based, have an integrated radio, and run a full 802.15.4, standards compliant 6lowpan stack.

Tuyo
Posts: 5
Joined: Mon Feb 11, 2013 2:12 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Fri Mar 15, 2013 3:09 pm

Maybe www.rasplogic.com project can be useful for your purpose

markushx
Posts: 3
Joined: Thu Nov 22, 2012 7:51 am

Re: Raspberry Pi as an 802.15.4 Basestation

Mon Apr 01, 2013 1:42 pm

Hi,

there are multiple options to get the RPi to be a 802.15.4 basestation:
1) A 802.15.4 device with a firmware which offers a PPP or SLIP interface and has the 802.15.4 stack on the microcontroller attached e.g. over USB (e.g. Zolertia Z1, MEMSIC TelosB)
2) A 802.15.4 device with a firmware which offers a USB serial interface and the 802.15.4 stack on the RPi (e.g. Redwire Econotag)
3) A 802.15.4 device with no firmware which offers a SPI interface and the 802.15.4 stack on the RPi (e.g. AT86RF231 or MRF24J40MA). (Like ab500's approach but bases on the kernel 15.4/6lowpan implementation.)

Option 1 can be used with TinyOS or Contiki on
* Zolertia Z1 with limited number of neighbors due to its restricted RAM.
* MEMSIC TelosB if the FT232 problems of the RPi are fixed.

I haven't tried option 2. It might be possible to implement the linux-zigbee serial line protocol for the Z1 and TelosB as well...

I am currently working on option 3 with an MRF24J40MA. There is a driver for that SPI device in the kernel now. I have created a PCB for the easy attachment of the MRF24J49MA to the RPi. Currently the kernel 3.8 compilation with latest 6lowpan net-next patches is on the way. (Having troubles booting that kernel ATM: http://www.raspberrypi.org/phpBB3/viewt ... 71&t=39123) The kernel source is at https://github.com/markushx/linux/tree/ ... mrf24j40ma for those interested.

jackrabbit123
Posts: 1
Joined: Tue Apr 02, 2013 11:20 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Tue Apr 02, 2013 11:23 pm

@ab500 - This project sounds great. I'm a little curious. Why not use something like Xbee Mesh or PTP?

khoarus
Posts: 1
Joined: Mon Jul 22, 2013 12:52 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Mon Jul 22, 2013 1:07 pm

markushx wrote:Hi,

there are multiple options to get the RPi to be a 802.15.4 basestation:
1) A 802.15.4 device with a firmware which offers a PPP or SLIP interface and has the 802.15.4 stack on the microcontroller attached e.g. over USB (e.g. Zolertia Z1, MEMSIC TelosB)
2) A 802.15.4 device with a firmware which offers a USB serial interface and the 802.15.4 stack on the RPi (e.g. Redwire Econotag)
3) A 802.15.4 device with no firmware which offers a SPI interface and the 802.15.4 stack on the RPi (e.g. AT86RF231 or MRF24J40MA). (Like ab500's approach but bases on the kernel 15.4/6lowpan implementation.)

Option 1 can be used with TinyOS or Contiki on
* Zolertia Z1 with limited number of neighbors due to its restricted RAM.
* MEMSIC TelosB if the FT232 problems of the RPi are fixed.

I haven't tried option 2. It might be possible to implement the linux-zigbee serial line protocol for the Z1 and TelosB as well...

I am currently working on option 3 with an MRF24J40MA. There is a driver for that SPI device in the kernel now. I have created a PCB for the easy attachment of the MRF24J49MA to the RPi. Currently the kernel 3.8 compilation with latest 6lowpan net-next patches is on the way. (Having troubles booting that kernel ATM: http://www.raspberrypi.org/phpBB3/viewt ... 71&t=39123) The kernel source is at https://github.com/markushx/linux/tree/ ... mrf24j40ma for those interested.

Hi Markushx,
I tried to communicate raspberry pi to MRF24J40MA but I didn't get the MRF24J40MA send packets, it's strange that I did see the spi pulse on the oscillograph. Could you please share your experience in working with MRF24J40MA with me?
Thank you very much

michas
Posts: 32
Joined: Fri Sep 14, 2012 4:19 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Tue Sep 03, 2013 10:56 pm

Hi

I am currently working on a project where Jennet-IP (802.15.4) is used for a home automation system.
We have tested the Jennet-IP and right now we want to replace Linksys border router which is shipped
with Jennet-IP development Kit with RaspBerry Pi.

Can someone give me some informations, requirements, suggestions, instructions if this is possible and
how can be done.

Thank

maddogjetz
Posts: 2
Joined: Tue Aug 28, 2012 7:47 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Mon Oct 07, 2013 5:09 am

Hi Andrew.
Great project. I have taken a look at the github project and it is quite impressive. I have been looking at several gateways and edge routers to find an inexpensive way to do just what you are proposing so zigbee devices can simply be managed on a pub-subscribed bus for OpenHAB-type system.

My thought is that it is too expensive to use other's hubs, and even if you find something cheap, it forces you to use a cloud-based ecosystem that is generally focused on its parent company.
Anyway, do you have any idea of a timeframe or target objective in sight for this project and the hardware?

I would like to start building around it if you are finding it reliable.

Thanks again,
Karl

Giacomoge
Posts: 1
Joined: Tue May 06, 2014 1:45 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Tue May 06, 2014 1:52 pm

Hi Markushx,
I'd like to try option 1 but I'm quite new about this world, could you give me some help like ''How to start''. I have a Raspberry Pi and some Zolertia Z1 devices.
Thaks a lot.

Regards,
Giacomo.
markushx wrote:Hi,

there are multiple options to get the RPi to be a 802.15.4 basestation:
1) A 802.15.4 device with a firmware which offers a PPP or SLIP interface and has the 802.15.4 stack on the microcontroller attached e.g. over USB (e.g. Zolertia Z1, MEMSIC TelosB)
2) A 802.15.4 device with a firmware which offers a USB serial interface and the 802.15.4 stack on the RPi (e.g. Redwire Econotag)
3) A 802.15.4 device with no firmware which offers a SPI interface and the 802.15.4 stack on the RPi (e.g. AT86RF231 or MRF24J40MA). (Like ab500's approach but bases on the kernel 15.4/6lowpan implementation.)

Option 1 can be used with TinyOS or Contiki on
* Zolertia Z1 with limited number of neighbors due to its restricted RAM.
* MEMSIC TelosB if the FT232 problems of the RPi are fixed.

I haven't tried option 2. It might be possible to implement the linux-zigbee serial line protocol for the Z1 and TelosB as well...

I am currently working on option 3 with an MRF24J40MA. There is a driver for that SPI device in the kernel now. I have created a PCB for the easy attachment of the MRF24J49MA to the RPi. Currently the kernel 3.8 compilation with latest 6lowpan net-next patches is on the way. (Having troubles booting that kernel ATM: http://www.raspberrypi.org/phpBB3/viewt ... 71&t=39123) The kernel source is at https://github.com/markushx/linux/tree/ ... mrf24j40ma for those interested.

k0ral
Posts: 5
Joined: Thu May 02, 2013 2:54 pm

Re: Raspberry Pi as an 802.15.4 Basestation

Tue Sep 16, 2014 3:27 pm

Hi Giacomoge,

have you found some way to start to make the Zolertia motes work with Raspberry?

Return to “Automation, sensing and robotics”