0%

I was about to give up on Hexo after finding new plugins I wanted to use but weren't working and stopped the generation of my blog. I narrowed it down (easily) to the ancient Hexo Paper Box theme I'd been using since the beginning.

So I did what anyone would do. Check out the Hexo themes section. Unfortunately its search feature is about all it has. No filtering based on popularity, newness or anything else.

So with a bit of Google-Fu I managed to find a great link that helped me find the Next theme.

Here's a few great sites that will help you get your Hexo installation get up to speed:

  • Awesome Hexo - a site for listing some of the best Hexo plugins filtered by users.
  • Hexo top 10 Themes - the top 10 themes by number of stars (this is how I found Hexo Next).

The Hexo Next theme I chose comes with a HUGE amount of customisation options for both Western and Chinese users along with theme-specific plugins you could find useful including minification, caching, etc.

THere's even theme selection for code blocks making it ideal for developer blogs.

Whats best of all though? No more errors on hexo generate .

Check out the Hexo top 10 Themes by stars and especially Hexo Next.

It's been a LONG time since my last post so my first port of call was recovering my last post which I stupidly hadn't pushed to rmeote before my hard drive died. Then I had to play with some plugins.

Here's some of the music I like to listen to when coding to get my blood pumping and get in 'the zone':

Or if I'm in a Prodigy mood (which is often) then somethng like:

If I want something a bit more vocal and hip hop style then a Prodigy remix like this is all good.:

The CJMCU 8128 breakout board includes a great trio of environment sensors that pretty much cover all the bases when it comes to sensing your local environment and has a few overlaps especially with temperature. I've only seen it avialable so far at Baggood.com.

In the picture below you can see each of the three sensors labelled:

# What's on Board

These relatively cheap sensors include 3 main modules - with links to their data sheets:

Its worth mentioning the temperature values returned by each of these sensors are all different and sometimes by a few degrees so you could either use all 3 and pick an average of the 3 or pick the one which has the smallest reported variance according to its datasheet. Which at the time of writing would be the HDC1080.

Having said that I'd still recommend checking the temperature's reporting against other sensors you may have and deciding for yourself.

# Hooking up to a Raspberry Pi 3

You only need to hook up the 5 of the 8 pins provided for all 3 sensors to work on a Raspberry Pi connected using the i2C bus with pins VCC and GND being self-explanatory. Although VCC should go to 3.3V supply pin on the Raspberry Pi. The SDA and SCL pins shoyuld go to the corresponding SDA/SCL i2c GPIO pins. The last pin to notice is the WAK pin which according to the documentation should go to a free Ground pin.
CCS811 datasheet[PDF]. The WAK(E) pin is used to wake a sleeping sensor from a hibernated low-power state. To make the module sleep you would put logic high to pin WAK and to wake the module you'd put logic low or Ground to that pin. As the whole breakout board uses only a tiny amount of power anyway and this post is about being connected to a Raspberry Pi I've chosen to hook up the WAK pin to GND to keep it permanently awake.

If you were using this on an ESP32 or ESP8266 where you wanted to take advantage of low power states then its worth looking further into this by checking the datasheets for each sensor.

See below for a photo of one connected and working with my home setup.

# Prerequisites

# Required Libraries

I've created a repo with an example that uses all three of the onboard sensors based off submodules of existing libraries that are out there for each. Adafruit have Python libraries for the CCS811 and BME280. With SDL having an example Python script for the HDC chip.

You can reach the repo with an example that combines all 3 of the submodules here.

There are other libraries you an use as the above uses Python mainly but especially in the case of the BME280

That library is what I am using with my own IoT setup at home with the small change of including and using Artik Python libraries to send my data to Samsung Artik for displaying the data in a dashboard format.

# Ensuring the Breakout is Connected Correctly

You can run the i2cdetect command with the following arguments:

i2cdetect -y 1

You should get the following output:

1
2
3
4
5
6
7
8
9
0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- 5a -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --

This stage is important as the default address for the BME/P 280 is 0x77 but in the CJMCU board it is as you can see above 0x76. Thankfully the Adafruit library comes with the ability to set the address on instantiation of the sensor class. See below...

1
2
3
4
5
6
sensor = BME280(
t_mode=BME280_OSAMPLE_8,
p_mode=BME280_OSAMPLE_8,
h_mode=BME280_OSAMPLE_8,
address=0x76
)

Great video from one of the devs responsible for Firefox's Dev Tools which
I now much prefer using over Chromes Dev Tools.

Check out the video below for info on the future of Dev Tools and a call to arms
for extension developers to speak up about what they'd like to API-wise to
hook into Firefox Dev Tools.

Some of the links to thing mentioned in the video are:

https://www.youtube.com/watch?v=oGobLmA_WVQ

Here's a not entirely comprehensive list of the MQ gas sensors often seen being used in Arduino smoke alarm or breathalyser projects. Like mine for example. I also have 2 of these set up as analog sensors on my Enviro pHat connected PiZero. One being an MQ135 and the other MQ-2. Not sure why I need to keep an eye on gas leaks in the living room but you never know! MQ-135 may make a bit more sense though to be honest it keeps a pretty still 0.41 value for the past several days. I may replace it with the optical Sharp GP2Y1010AU0F dust sensor as a general air quality indicator.

  • MQ-2 - Methane, Butane, LPG, smoke
  • MQ-3 - Alcohol, Ethanol, smoke
  • MQ-4 - Methane, CNG Gas
  • MQ-5 - Natural gas, LPG
  • MQ-6 - LPG, butane gas
  • MQ-7 - Carbon Monoxide
  • MQ-8 - Hydrogen Gas
  • MQ-9 - Carbon Monoxide, flammable gasses
  • MQ131 - Ozone
  • MQ135 - Air Quality (CO, Ammonia, Benzene, Alcohol, smoke)
  • MQ136 - Hydrogen Sulfide gas
  • MQ137 - Ammonia
  • MQ138 - Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas, Hydrogen
  • MQ214 - Methane, Natural gas
  • MQ216 - Natural gas, Coal gas

While you're here you may find the following tutorial on how to read MQ sensor values using a Raspberry Pi and how to convert its analog data output to a digital output for the Pi.