Hi, I’m Alexander, I’m a master’s student in Multimedia Communication Technology. For my dissertation, I received the topic of creating a wireless sensor network using the ZigBee protocol. I’m new to the world of smart homes, I’m also new to using ZigBee standards. As for the theory, I understood that and learned a lot about the ZigBee standard for smart homes, but now the problem is the practical realization of the project. I chose the ZigBee CC2530 for my ZigBee module, but I’m not sure how to run it, how to configure it and and incorporate it into your project with the ATMega328P. Has anyone worked with this module and d, but can it help me a lot would any help help me?
You can contact me here or at the email address: [email protected]
Thanks a lot !
Here are instructions how to flash the CC2530 :
https://www.zigbee2mqtt.io/advanced/zigbee/05_create_a_cc2530_router.html#what-do-i-need
Coordinator firmware can be found here:
I don’t know any port of Zigbee2mqtt or Zigbee2Tasmota for the ATMega328P. Can you even run a MQTT server on that hardware ?
Thank you for your reply, I took the SmartRF04ED debugger to flash my ZigBee cc2530 module. I don’t know, I didn’t find it, so I asked. In principle, the sensor node consists of an Atmega 238P microcontroller based on an Arduino pro mini board, a temperature sensor, an actuator and an RF module based on the ZigBee CC2530. It bothers me, how can I set in my code that when the sensor detects, for example, the room temperature, after processing this temperature data, I send the data via my ZigBee module to the data of the main sensor node (sink)?
What is the name of the program through which I can flash my ZigBee?
Hi Alexander,
A long time ago I was a M.Eng student with a thesis project so understand the pain of moving from whiteboard to breadboard. My ability to help is sadly limited by never having developed using the ZigBee stack, but here goes…
The key question is what do you want ZigBee do to for you?
There’s a world of difference between using ZigBee as a network layer to send hand-crafted serial via an AT-command controlled Digi radio module, to having something that appears as a consumer-level device and can be adopted into HASS as a ZED with auto-discovery.
I suspect the confusion is the difference between a ZigBee coordinator (ZC) and a ZigBee end device (ZED). Most users of HASS are interested in creating a low-cost USB device to control commercial ZigBee modules (ZC) - not developing the modules themselves (ZED). The link above is closer as it creates a router for better mesh radio coverage, but still not a sensor or actuator exposing controls via an API.
Many HASS hobbyist projects use something like an ESP8266/ ESP32 uP flashed with Tasmota / ESPhome firmware to create custom devices connecting over WiFi and MQTT with several application layer enhancements to add auto-discovery and configuration in HASS. The process is low-code or no-code via configuration of pre-built libraries, rather than direct compilation of an Arduino sketch. Naturally, an Espressif micro with WiFi uses a lot more power than ZigBee but the ease of development wins out.
Notice how one device requires a mix of different standards to work - understanding the separation of physical layer, up to application layer in an OSI 7-layer model is often hard work with lots of lovely grey areas!
I’d start with a more hardware oriented forums. Creating a custom ZigBee end-device has a few hits on HackADay. Tasmota also seems to support Zigbee but again more as a ZC than a ZED. This suggests there are open-source ZigBee Arduino libraries out there to be found as that’s what Tasmota is based on. AdaFruit seems to suggest ZigBee profiles make devices easy, but doesn’t include links to back the statement up!
ZigBee used to be managed by the ZigBee Alliance but ISTR they re-branded as the Connectivity Standards Alliance. I don’t know how much is FOSS, and how much has a developer NDA. Sadly, the difference between a bare board module from AliExpress and an expensive developer kit is often what you’re asking for - documentation and example code.
In commercial environments, the cost of the dev kit is tiny compared to the cost of the software engineer’s time. In academic environments though you can often get evaluation stuff for free - ask the vendors for help. This works for a one-off thesis, but not if your course of 30x tries the same thing!
Confusingly, interest in the IEEE 802.15.4 transport is increasing as the Matter/ Thread standards get ready for release. Thread is very similar to ZigBee, with a similar network but different application layers, with Matter bridging different networks. As you’re using ZigBee, ignore Google I/O and the developer docs for Matter.
To interface custom sensors and actuators into HASS, my own projects have used:
- ESP8266 running Tasmota, connected via WiFi, using MQTT with auto-discovery.
- Raspberry Pi Zero, connected via WiFi, running Raspbian and custom Python using MQTT with auto-discovery.
- ESP8266 running ESPhome, connected via WiFi, using HASS APIs directly.
After years of bit-bashing in machine code and C, Python or no-code configuration toolkits are so much easier. If you are starting from scratch, 80% of your project time will be getting a toolchain setup for the ATmega with the libraries needed to flash a LED (the uP equivalent of "Hello World\n"
)!
All the best,
James
First of all, let me thank you, Mr. James, for such a detailed answer and advice. What I want from my ZigBee is to transfer telemetry data from the sensor node to the main sensor nodes (sink) which, after receiving the data, would further transmit data via computer and server to the user on the mobile phone.
The sensor detects a change in temperature (SENSO NODES 1), sends data from the sensor to the ATMega 328P microcontroller, and the processing data is packed into a packet. The packet is forwarded to the Zigbee cc2530 from which it is sent by zigbee network to the drain (Sink-MAIN SENSOR NODE) which receives the telemetry packet on its zigbee cc2530 module and forwards the ZigBee network to the zigbee module (ZigBee on USB PC) on the computer. The data is then uploaded from the computer to the server to which the user accesses the telemetry data recorded by sensor node 1 via his mobile application (USER APP). to activate the actuator on the sensor node, so I emphasized Tx / Rx in the picture, because communication in both directions is needed. Attached I will post a picture to see a block diagram of the telemetry data exchange as I imagined and pictures of sovg hardware for my smart home network.
I thought that the ZigBee module is managed as if it were managed by a GSM module, for example (which I have already used for my projects), but I read a lot and as far as I understand it can be used via AT command, but there is an easier way (If I am not wrong). Now I’m interested in examples of how to use my hardware and ZigBee in a project. I hope you understand what I want to do with my ZigBee CC2530 module. Basically, I should use the ZigBee CC530 module in my project, as ZigBee IEE 802.15.4 is considered the standard for implementing a wireless smart home network. But now to see how to use it, if anyone has a suggestion feel free to write.
As for the ESP module, I used ESP 01, but unfortunately I can’t use it in this project task.
LINK MY BLOCK SCHEME: EXAMPLE — ImgBB
Communication scheme between nodes and users
The point is to have 6 sensor nodes in the network connected in a star topology
Thank you very much for your attention and time
Sensor Nodes 1 hardver components:
1. Sensor Temperature
3. Microcontroller ATMega 328P
**4.ZigBee CC2530 module **
The sink (Sink-Main Sensor Node) consists of a microcontroller and a ZigBee CC2530 module
ZigBee on USB-RS485 for PC:
Zigbee module that receives and sends data on the PC side for upload to the servero
Hi,
My understanding is there is a difference between a ZigBee radio (really 802.15.4), and what home automation consumer applications call ZigBee.
Bottom-up approach - custom protocol over ZigBee radio
If you just want radio comms, I think you can control some ZigBee radios (Digi has been mentioned on HackADay) via AT commands and write your own custom protocol above the radio transport layer (which could be simple ASCII strings). Read the HackADay project links to see if the example is useful.
This bottom-up approach would start with data sheets for the CC530 module and writing your own code. There may be useful libraries to drive the radios, and perhaps even to handle higher ISO layer functions - you need to look for similar projects, collect Arduino code libraries, and see what works. If you are lucky, you might end up with a small amount of custom code calling a lot of library routines to do the heavy lifting, but the data structures sent and received will be custom - your own protocol.
A good start would be setting up two nodes and using AT-commands to send ASCII between them over ZigBee - just as you would over Ethernet or even RS232.
Top-down approach - create a “standards-compliant” ZigBee ZED
The other option is to think like a consumer ZigBee device manufacturer, and work top-down. A device manufacturer isn’t interested in writing low-level code, only creating a device profile for this specific product (e.g. temp sensor and switch endpoint profiles), minimal driver code to process requests, with everything else compiled in from a reference design written by some one else. The aim is to create sensor node devices which Home Assistant and a ‘standard’ ZigBee binding would recognise.
The PC server radio, driver code, server, and user app would be simply standard Home Assistant - BUT you need to create sensor nodes that are compatible enough with the full ZigBee (radio and comms protocol) to work.
This option needs to rely on Connectivity Standards Alliance documentation, example code, and perhaps a full tool-chain from libraries to template device definition. If you can’t get access to their documentation, or a FOSS project which has reverse-engineered it, you can’t create a sensor mode compliant with their standard.
HASS has clearly implemented ZigBee device drivers and all layers of the protocol to create a FOSS binding (a ZC), but I’ve never tried creating a ZigBee end device (ZED) from open-source libraries as Tasmota / ESPhome make the MQTT equivalent trivial. Consumer ZigBee sensors are also very cheap to buy!
A brief look turned up a few projects so you may be in luck, but some mention specific tools like compilers.
- Building own zigbee device using arduino + zigbee shield - #9 by patrick_jane
- 35 Projects tagged with "ZIGBEE" | Hackaday.io
If you can get documentation and libraries, a good start would be to implement the temperature sensor, as this is basically the same as a cheap Sonoff device - perhaps copy the device profile from Home Assistant?
As an aside, your project scope could be met with a Sonoff temp sensor, a Sonoff switch, a ZigBee co-ordinator, Home Assistant on a Raspberry Pi, and the Home Assistant app. The only control code would be a pretty simple automation in YAML, but you’d not learn anything about hardware development by using Common Off The Shelf parts!
All the best,
James
Thanks for the agreement, I’m afraid I won’t be able to use the “Sonoff” equipment, because it’s practically just connecting devices without any software design and development. My task is to develop my own wireless network and software using the above components. I will have to look for more on this topic, and maybe someone else will come up with some more advice.
Thank you very much James, you helped me a lot
But now I wonder if there really are AT commands for the ZigBee CC2530 and if I configure it to work in RX mode via TI SmartRF Studio software, then I will be able to adjust the telemetry data recorded from the sensor (e.g. temperature) into one string to command AT via my ZigBee CC2530 module forward to another ZigBee CC2530 receiving module, which will be configured to work in TX mode and so I will transfer data. But only if there are AT commands for the ZigBee CC2530 module.
Hey, actually I didn’t investigate this any further. However, I found two other boards, which I havent tried out yet:
I have ordered the first one, however I also did not start development. The downside of this one is, it needs a proprietary firmware, where you need to get even a paid version if you need advanced features (power saving).
The second one I am unsure whether it can be used to implement end-devices (sensors). I have tried to post in that forum, but my post has not been approved for weeks.
The third board I have actually found is the Nordic Semiconductor based Adafruit Feather NRF52840 express (Adafruit Feather nRF52840 Express : ID 4062 : $24.95 : Adafruit Industries, Unique & fun DIY electronics and kits). As I understand it, it can be used to build zigbee end devices. However, it requires the use of the nordic semiconductor SDK and libraries and toolchain. Some months ago I have downloaded all the stuff, but never got to the point where I actually started development. There is no straight forward way of doing this, as you need to read tons of documentation, but the board itself looks awesome to me. Its tiny, and features a JST connector for connecting batteries, which can be recharged by connecting USB power to the board, which is great if you want to build battery powered devices.
All in all, I did not yet get to the point of a finished zigbee end devices, but this is what I have found out so far.
[edit] @Aleksandar-bit I have just quoted FloatingBoarders post as he referred to one of my topics. However adding to your actual question and topic, it might be worth mentioning that the board 2) I have posted (“MonaLisa”) is some self-designed board made by the guy in the linked forum, and its said to be suitable as zigbee router/coordinator. Maybe it would be worth contacting this guy for you. Maybe even if you dont want to use the board itself, the creator might have knowledge of the protocols and implementation and might help you out with your project.
Thanks for the answer, do you know if the ZigBee CC 2530 supports AT commands?
I’m afraid I don’t know much about zigbee on protocol-level. I am only using it with commercial devices I have integrated into HA.
I wanted to build my own sensors as replacement for wifi-/mqtt-based arduino stuff, but I havent gotten much far. So I don’t even know what AT commands are, I’m sorry
ok, thanks in any case for the answer and time
Yeah youre welcome, though I did not help much.
Maybe during your project you come up with something that can be reused easily by us makers
Hi Aleksandar,
Here’s a post to read as it links to a closed-source “freemium” firmware build for the CC2530 which appears to be the ZigBee equivalent of Tasmota - e.g. flash to a generic board, configure common supported sensors, and create a ZigBee device exposing a standards-compliant binding:
https://ptvo.info/zigbee-switch-configurable-firmware-v2-210/
If correct, and it works (been an engineer too long to believe anything until testing has completed!), there’s no need for a ATMega in sensor modes as DS18b20, DHT*, and relays are supported directly on a CC2530.
The firmware seems to have a premium version for $6.95 per node, and is closed source - the FAQ suggests the project is based on the ‘TI Z-Stack’, which suggests to me that TI has a commercial development kit for ZigBee - perhaps something else to research if your studies mandate a different architecture. Note the way the project works - pretty much the top-down approach configuring a device profile without changing any code.
All the best,
James
Hello Mr. James, thank you again for your answer, your tips and links mean a lot to me. Probably only the CC2530 was used in this project as the CC2530 is based on the integrated Intel 8051 series of microcontrollers. Maybe I can just use it, just see how to configure it, or activate its analog and digital pins because of the sensors and actuators. I found a lot of configuration documentation, I can share if anyone is interested. Just to find and see how the 8051 microcontroller is programmed on the CC2530.
Thanks again for the reply, all the best