bleno writeup (updated)

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals. Need a BLE central module? See noble. Note: macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only supported OSes. Prerequisites OS X install Xcode 10.9 or later Linux Kernel version 3.6 or above libbluetooth-dev bluetoothd disabled, if BlueZ 5.14 or later is installed. Use sudo hciconfig hci0 up to power Bluetooth adapter up after stopping or disabling bluetoothd. System V: sudo service bluetooth stop (once) sudo update-rc.d bluetooth remove (persist on reboot) systemd sudo systemctl stop bluetooth (once) sudo systemctl disable bluetooth (persist on reboot) If you’re using noble and bleno at the same time, connected BLE devices may not be able to retrieve a list of services from the BLE adaptor. Check out noble’s documentation on bleno compatibility Ubuntu/Debian/Raspbian sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev Make sure node is on your path, if it’s not, some options: symlink nodejs to node: sudo ln -s /usr/bin/nodejs /usr/bin/node install Node.js using the NodeSource package Fedora / Other-RPM based sudo yum install bluez bluez-libs bluez-libs-devel Intel Edison See Configure Intel Edison for Bluetooth LE (Smart) Development FreeBSD Make sure you have GNU Make: sudo pkg install gmake Read more…

Using a Smart Motion Sensor with Home Assistant

If you’re looking for a straightforward yet powerful method to safeguard your home or office, a smart motion sensor linked to Home Assistant might be the perfect solution for you. This way, you can establish a basic alarm system that can recognize and inform you of any unanticipated movements in your area. Regardless of whether you’re present or not, you can rest easy knowing that your property is being watched over around the clock. This article will demonstrate how to create this setup. Also for those wanting to use the sensor to switch on/off a light this post can be of value. Getting started Before you dive in, it’s important to check out our previous posts on “getting Home Assistant up and running with MQTT and ZigBee” as a starting point. Once you’ve got that set up, you can follow along with our working installation of Home Assistant with MQTT and ZigBee2MQTT already up and running. To get started, all you need are some ZigBee-compatible motion sensors. I opted for one from SilverCrest that I found on discount at the local grocery store, but other options should work just as well. To begin, simply follow the instructions that come with Read more…

Making a stand-alone air quality monitor from our upgraded IKEA Vindriktning

Monitoring the air quality in spaces where you spend a lot of time can be a game-changer for your well-being and productivity. However, the air quality monitor built-in a previous post is tightly linked with Home Assistant (HA), which might limit its use in environments like offices, workshops, garages, and more. The good news? We can easily add additional LEDs and link them to the new sensor values directly in ESPHome, so those will work even when not connected to HA. Furthermore, the esp8266 is just powerful enough to function as a WiFi access point while hosting a web page that displays all sensor readings. This guide will walk you through adding additional status LEDs and reconfiguring ESPHome to unlock this stand-alone functionality, turning your air quality monitor into a tool that can be used anywhere! What you need? This post will start from the DIY smart air quality sensor which you can build from an IKEA Vindriktning Air Quality Sensor, an ESP8266 and Bosch BME680 (humidity, pressure, temperature and volatile organic compound (VOC) sensor). Though we can additionally add two white LEDs, that can be programmed to give a visual cue to the BME680 readings and hence make it Read more…

A Simple Guide to Zigbee Wireless Networking

As computer communication professionals, we are well aware of the significance of wireless communication protocols in today’s connected world. Among the numerous wireless protocols available, Zigbee has emerged as a popular choice for low-power, low-data-rate applications. In this blog post, we will delve into the details of the Zigbee protocol, its architecture, and how to implement a Zigbee-based network. What is Zigbee? Zigbee is a low-power, low-data-rate wireless communication protocol based on the IEEE 802.15.4 standard. It operates on the 2.4 GHz frequency band and has a data transfer rate of up to 250 kbps. Zigbee is designed for applications that require low power consumption, low cost, and low complexity, making it an ideal choice for IoT devices, home automation, and industrial control systems. Zigbee Protocol Architecture The Zigbee protocol architecture consists of three layers: the Physical Layer (PHY), the Media Access Control Layer (MAC), and the Application Layer (APL). Physical Layer (PHY): The PHY layer is responsible for transmitting and receiving raw data bits over the wireless channel. It defines the modulation scheme, data rate, and transmission power.Media Access Control Layer (MAC): The MAC layer is responsible for controlling access to the wireless channel, managing data transmission and reception, Read more…

Unveiling the Mysteries of BLE 4.0 Range

With the rapid development of the Internet of Things (IoT), Bluetooth Low Energy (BLE) technology has become increasingly important. As the latest version of BLE technology, BLE 4.0 has sparked intense interest in its range. So, how far can BLE 4.0 reach? Today, we’ll uncover the mysteries of BLE 4.0 range. Overview of BLE 4.0 Technology BLE 4.0 is the fourth generation of BLE technology, released by the Bluetooth Special Interest Group (SIG) in 2010. This technology marks a significant leap forward in BLE, featuring lower power consumption, faster data transmission speeds, and longer communication distances. How Far Can BLE 4.0 Reach? The range of BLE 4.0 refers to the maximum communication distance between devices. In ideal environments, BLE 4.0 can reach up to 100 meters (328 feet). However, actual environments are often affected by interference, obstacles, and other factors that can impact BLE 4.0 range. The main factors that affect BLE 4.0 range include: Environmental interference: Signals from Wi-Fi, Bluetooth, and mobile phones can interfere with BLE 4.0 signals. Obstacles: Walls, pillars, and furniture can block BLE 4.0 signals. Device transmission power: Higher transmission power can increase BLE 4.0 range. Receiver sensitivity: Higher receiver sensitivity can also increase BLE Read more…

DeckLock: keep track of your card games

Currently I’ve been playing KeyForge and Gwent. One of my first posts was about Magic: the Gathering and my 3D printed dice and token boxes also made an appearance on this blog. So it is no secret I like card games, and my collection of decks both on- and off-line is rapidly growing. There are plenty of tools to keep track of your decks for a single game, however I want to create something myself that supports all games I play. This was also a good opportunity to learn Pelican, a static website generator for Python. I’ve been using Jekyll for some time, though developing extra features (like the ones I presented in the previous post) requires the programming language Ruby. As I’m not well versed in Ruby, it would be far more efficient to use my preferred programming language Python. Pelican seems to fit very well and this was a perfect project to check this out myself. You can see the result of this blog here. The code and instructions to build DeckLock with your own decks can be found on GitHub: https://github.com/4dcu-be/DeckLock Introduction KeyForge KeyForge is a game designed by Dr. Richard Garfield, famous for creating Magic: the Read more…

Simple USB Type-C Upgrade for the Raspberry Pi Pico

With USB type C ports now commonplace, keeping micro-USB cables around for some devices can be a bit of a nuisance.The convenience of a single, reversible cable for nearly all your devices is undeniable, and in some devices the micro-USB port can actually be replaced with a USB type C one… given you aren’t afraid of a little soldering. Before tackling more intricate electronics, let’s start small — a simple mod for the Raspberry Pi Pico the perfect way to get started. Requirements This project calls for some essential soldering tools. A soldering iron, sponge, and solder should be enough to get you started. Along with these tools, you’ll need a few additional components: a Raspberry Pi Pico four pieces of electrical wire (which I salvaged from an old USB cable) a female USB Type-C breakout board that exposes the ground (GND), voltage (V), data plus (D+), and data minus (D-) pins (Note: If you plan to use a USB-C to USB-C cable, it should support power delivery.) Selecting the right breakout board is crucial, as not all boards are suitable for this project. For this modification, search for a board that exposes the GND, V, D+, and D- pins Read more…

The Web Bluetooth module for Angular

For the past few months, I’ve been playing around with the new Web Bluetooth API which is about to ship in Chrome 56 in February 2017. And let me tell you, this new feature just unlocked lots of new possibilities for the Web. As a Web Advocate, I was so excited and couldn’t wait to build an application showing how easy it is to combine Angular and the Web Bluetooth API (even more, with any of the upcoming Web APIs, more on that soon, stay tuned). Let’s meet The Missing Web Bluetooth Module for Angular Application I started then working with my buddy François Beaufort (kudos to him!) to build a demo app, a kind of proof of concept that illustrates how to integrate Web Bluetooth with Angular. After implementing a couple of use cases, I came up with an Angular module which abstracts away all the boilerplate needed to configure the Web Bluetooth API. A Few Disclaimers Web Bluetooth APIs I am going to assume that you’re already familiar with the Web Bluetooth APIs: GATT server, Services, Characteristics…etc. Please make yourself comfortable with this topic before reading the next sections. Here are few resources: https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web https://medium.com/@urish/start-building-with-web-bluetooth-and-progressive-web-apps-6534835959a6 Observables I am also assuming that you have Read more…

KeyForge: How many decks were printed ?

KeyForge is often advertised as having 104 septillion possible decks per set (that is 104 followed by 24 zeros), but how many of those decks actually exist? Fantasy Flight Games never released data on how many decks were printed per run. Though with Dark Tiding having Evil Twin decks (exact copies of other decks, but with Evil versions of certain cards), we can actually estimate the total number of decks printed! This allows us to get a grasp of which percentage of decks are registered. How to estimate the number of printed Dark Tidings decks ? In the previous post a trick used in ecology, called Capture-Mark-Recapture, to estimate the number of animals in a given population, without counting all of them was shown. The basis for this strategy is visiting the site twice, and being able to capture animals each time independently. The first time captured animals are marked and released, the second time around the total number of animals caught and how many of those were marked is recorded. From those numbers you can, using a relatively simple formula, estimate the total population size. To apply this to KeyForge, Evil-Twin decks in Dark Tidings are key (pun intended). Read more…

Capture-Mark-Recapture model in PyMC3

Imagine you wish to know how many fish are in a rather large pond… The water is murky so forget about counting them easily… In ecology this is a common problem! The population size of a species often needs to be known, but it is either impractical or simply impossible to count all individual members of that population. Fortunately, there is a relatively easy solution to get an estimation! To estimate the size of the population you would have to visit the site twice. On the first visit a number of animals are caught, marked and released. It is important to mark them in a way it doesn’t do them any disadvantage or harm, equally important is to use marks that don’t easily rub off. You keep count of how many members of the population were caught and marked. Next, a day or so later, the site is visited again and a number of animals is caught. This time the number of marked animals that were recaptured is important. As the fraction of the marked individuals captured the second day, is essentially the same as the fraction of the population that was marked the first day. This method goes by Read more…