Navigation

How to select and flash CC2530

How to select a CC2530 board

Ebay and Aliexpress offer several boards with the CC2530 chip (keyword: CC2530). You may select any board, but use the following criteria:

  1. The board must have the CC2530F256 chip (fig. 3). The key number here is 256 and it means 256 KB of flash memory. Most firmware was compiled for 256K memory.
  2. The board may have many pins or contacts. If you do not have a soldering iron then select a board with headers. I would suggest to select a board where each pin has the corresponding label. The label may slightly different on different boards: P0.2, P02, P0_2 are the same pin. The board must have at least the following pins:
    1. Po.2, Po.3, P2.0 – used for a UART interface. If you plan to use this board instead CC2531 and connect to your SBC like Raspberry Pi, then you need these pins. If you’ll upload a router firmware to this board then these pins are optional.
    2. P2.1, P2.2, RST – used for uploading firmware.
    3. GND – ground.
    4. Power source (VCC) – it may be 3.3V, 5V or both. This pin can be marked by VCC only. Internally, the CC2530 chip uses the 3.3V voltage, but a manufacturer may add a voltage regulator on the board and you may use any supported voltage (3.3V or 5V, no difference). Please, read a description for this board carefully about the voltage.
  3. The board may include an additional small chip (fig.5). Most likely, this is a wireless signal amplifier. Usually these boards contain “Long range”, “RF front-end”, “RF amplifier”, “CC2591”, “RXF2401” in a description. These boards require a special firmware. I would suggest to select this board if you really have a firmware for this combination of the main chip (CC2530) and the RF front-end chip.
  4. The board may contain an antenna on-board (fig.2, 3, 6) or a connector for an external antenna (fig. 1, 3, 4, 5). The board with an external antenna will work better in most cases.
  5. Some boards may have a metallic shield over the main chip and/or the RF front-end. This shield protects the board from radio noises (good). But I would suggest to buy this board from a trusted vendors only because you cannot be sure about chips under this cover.
  6. Rare CC2530 based boards may include an USB interface (fig. 6). CC2530 does not have native USB support apart from CC2531. Therefore a manufacturer adds an additional chip on the board. The additional chip implements the USB interface and the CC debugger. Therefore you can upload a firmware to this board without a special debugger (CC debugger or SmartRF04EB).  Therefore it holds small space on your work table. It can be useful for developers. If you need only one CC2530 or CC2531 for a coordinator role you may save money. Please, read a description for a board carefully because this USB interface and chip may be used for another purpose. Therefore I cannot recommend this board for beginners.

CC2531 based router (firmware)

I’ve replaced my old coordinator hardware with CC2530 with an external antenna and therefore one of CC2531 was not used.

The guys on GitHub asked me to make a router firmware for СС2531 too. I’ve spent some time and prepared 3 variants:

  1. CC2531-router.hex – just a router, without diagnostics and a USB serial port.
  2. CC2531-router-diag.hex – a router with diagnostic reports and without a USB serial port.
  3. CC2531-router-diag-usb.hex – a router with diagnostic reports and a USB serial port. The firmware dumps diagnostic reports to the serial port too.

CC2530 based Zigbee coordinator and router

Introduction

My smart home infrastructure contains several Xiaomi humidity/temperature and door sensors. I’ve used these sensors with the corresponding Xiaomi gateway. The gateway was connected with my BananaPi M2U and Pimatic. But my home is long and tall. One gateway does not cover all rooms and therefore far sensors disappear periodically.

I’ve googled and found I can use Xiaomi sockets (Zigbee edition) like Zigbee routers. This socket is less expensive than a new gateway and it has a smaller size. I’ve purchased tow sockets and used it about a month. This socket has a big problem (from my point of view). It can go into the deep sleep mode and cannot forward data packets from sensors.

Analog input with ADS1115 in Python

Python has the pretty good library “WiringPi-Python“, but it depends on WiringPi2 for Raspberry Pi and cannot be installed automatically through pip. Here is a solution.

In my project I want to control a battery voltage and a charging state for my LiPo battery. Therefore I’ve added the ADS1115 board.

I’ve installed WiringPi2 for BPi and tried to read analog inputs through the gpio command line utility.

1
$ gpio -x ads1115:200:0x48 aread 200

The main disadvantage of this method for me is the default analog reading settings: 128 samples per second and +/-4.096V range (my battery voltage is 4.2V). You cannot change these setting in the command line utility.

Sending SMS via MQTT. Strange? No, this is simple.

In my home automation system I need to send alarms and events via SMS to my mobile number because an internet connection is not stable and may absent on power loss. Therefore I’ve purchased a compact board with the SIM900 chipset.

sim900a

Note: SIM900A – this is an Asian version of this chip and does work in Europe. I’ve flashed the “1137B02SIM900M64” firmware and now it works well with my SIM cards. Here is the blog with many firmwares, flashing tools and instructions.

I’m using Pimatic and it does not have a ready-to-use plugin for this GSM modem. I’ve found a python code on the web that easily allows to send SMS using both ASCII and Unicode modes. My work is to create a daemon that will route MQTT messages to a SMS messages and vice versa. Pimatic has the very powerful MQTT plugin and I can send SMS messages using built-in rules.

Additionally I can process incoming SMS messages and execute commands from SMS messages by subscribing to a selected topic.

My github repository.

1-wire on Banana Pi BPI-M2 Ultra

Banana Pi BPI-M2U has the Allwinner R40 chip. This chip does not include a hardware 1-wire interface. But we can implement this data exchange protocol at the software level using the bit bang method. The default Linux kernel (Raspbian Jiessie, 3.10.107) does not include the w1-gpio kernel module. I’ve tried to compile it, but it has many dependencies. I’ve found w1-gpio-cl. This is a Linux kernel-mode driver substitutes w1-gpio 1-wire bus master driver. Contrary to the standard driver, w1-gpio-cl doesn’t need many other kernel modules. Also you may configure this kernel module using command line parameters.

Cross-compilation for Banana Pi M2U

Using BPi for kernel (re)compilation is quite painful because it is very slow for this task. So I configured a virtual machine (VMWare in my case). Now, the kernel can be compiled in 50-80 seconds on my i7-4770. The configuration is easy if you read the following tutorial. I’ve tried several options before and selected this one.

Banana Pi M2 Ultra. My start.

Some time ago I’ve purchased RPi2 and built my first smart home server (powered by Pimatic). Everything is good with this solution but currently I need more:

  1. More memory.
  2. More CPU performance.
  3. Fast internal storage (eMMC preferable).
  4. Backup battery.
  5. All wireless interfaces (Wi-fi, Bluetooth).
There are no more results.