LoRa32u4 by BSFrance.Fr (Blog Entry Part 2)

I haven’t had a vast amount of time to spend on this lately as I have been really busy at work amongst other things, but I found a few moments to look at this module again over the weekend. I am very pleased to say that I managed to get the module working with a NRF24L01+ chip. I initially made the mistake of incorrectly wiring it up using all the digital pins on the right-hand side of the LoRa module but then quickly realised that it provides dedicated MOSI, MISO ports etc on the left-hand side. I think I was stuck in the Arduino frame of mind. I still had to attach two of the cables from pin 3 and 4 on the Nrf to pin 9 and 10 on the LoRa module respectively though. Which made sense in the end. I uploaded and ran the listening script I have been using with an Arduino and it ran perfectly, even picking up signals from my moisture sensors from the greenhouse down the bottom of the garden. So obviously the LoRa module appears to be supplying sufficient power to the Nrf which is great news and I am one step closer to removing a Rasperry Pi Zero W and an Arduino from my set up. I love the above combo and if I had a mains connection option I wouldn’t go to the effort described here. Saying that, its always great to learn something new.

Megasaur Rack Extension for Reason

If you’re looking for a good Saw-based rack extension then look no further than this one. Available to buy at the Propellerheads Shop.

Megasaur in the Reason Rack (image used for illustration purposes only
Megasaur in the Reason Rack (image used for illustration purposes only

I won’t regurgitate the details of the rack extension’s features here as you can read all about them in the shop page on the Propellerheads site. It’s a simple to use synth but it produces some amazing saw-based sounds. I have used a couple on my latest piece of music. I am not normally a massive fan of saw sounds. I find them a bit harsh, but in the case I make an exception. Some of the sounds it produces contain a lot of depth and sound very rich. There’s a couple of dark sounding presets which sound very gritty and lo-fi and have added a lot of texture to my latest piece. Very impressed with it. If you’re a Reason user, I wouldn’t hesitate to buy it, and it’s also very reasonably priced (no pun intended).

Local Alexa with Node Red: bloody fantastic!

https://flows.nodered.org/node/node-red-contrib-alexa-local

I am a massive fan of Node Red, as it greases the wheels of  IoT development in my own personal projects. It just makes things so much easier to do. Want to grab some serial input from an Arduino attached to a Ras Pi? Just drag and drop a Serial node onto the canvas, and NR takes the all the hard work away from you.

I always check the Node Red Flows page to see if there is anything new, and on this occasion I came across a local Alexa node which emulates a Phillips Hue bridge, and allows you to operate simple connected On/Off switches to such things as lights.

It’s fantastic, because there is almost zero set-up. All you do is to drag-and-drop the Alexa Local node onto the canvas, change the name to something sensible (omitting the ‘on’ and ‘off’ words, as NR sees to this for you) such as ‘Bedroom Light’, link that to the action that operates the ‘Bedroom Light’ (which in my case is via an attached 433mhz transmitter) and press Deploy.

You just need to then say ‘Alexa, discover services’ to your Echo and after 20 seconds or so, you’ve got a voice command to operate a physical device. In the example given, you’d say ‘Alexa, bedroom light on’ and (hopefully) your light will turn on. And as far as I can tell, this will happen on your local network without going out over the Internet, which should help with privacy.

I’ve got this to work with my computer, by attaching a local Alexa node to a Wake-On-Lan (WOL) node and now I can switch on my PC with my voice, even if I am in a different room.

Awesome! Well done to the people who created this superb node!

Excellent Open-source alternative to Visio

These days rather than just shell out loads of cash on software, I like to see if there is a good open-source/free alternative. This time I was looking for something that would work similar to Microsoft Visio, and I’ve found it with the Dia Diagramming Tool. You can get it from SourceForge

Testing a Waveshare 2.13inch E-Ink display HAT

 

I do like Waveshare products. In my experience they are always well constructed, and work pretty much straight out of the box. I’ve got a couple of Waveshare colour 5-inch touchscreens that work very well.  One day I got an email from AliExpress about new technology and offers, and I noticed these funky little e-paper screens from Waveshare. It looks like the price of e-paper screens is now starting to come down somewhat, as I got these for about £13 a piece. The screen on the left in the image above is 2.1-inch and the one on the right is 1.3-inch (if my correctly memory serves me). The smaller one is two-colour which is quite a novelty to me as up to now I’ve only seen one-colour screens.

I decided to attach this module to a spare Arduino Uno I have got at home. Later I am going to scrap the Arduino and see if it will work with just the ATMEGA328 chip on a breadboard. The connections look like this:

Module           Arduino
3.3V                 3V3
GND                GND
DIN                   D11
CLK                  D13
CS                     D10
DC                     D9
RST                  D8
BUSY               D7

Next thing I needed to do was to download the Demo library, run the demo Arduino sketch and I was up and running. The demo sketch is a very good intro to using the screen, and to be honest, it’s pretty easy to work with.

Next thing I want to do is to get some data from one or more of my sensors, either via serial or through data captured using a NRF24L01+ wireless sensor. The latter option will be more complicated as I am going to have to figure out how to share the SPI pins that the screens use and the NRF module uses.

Anyway, more on that next time I update the blog about this subject.

RCWL – 0516: Pretty impressive!

I find it hard to believe that you can buy a little radar-based motion detector for less than a quid (definitely don’t buy these off Amazon as they are at a rip-off price compared to AliExpress). And it’s especially difficult to believe that it works with no  problems! As you can see from the image, I’ve soldered a few headers onto the board so that I can plonk it onto a breadboard. I think my soldering station needs a new soldering tip as the solder kept rolling around the header. The solder eventually settled and took, but I was scared I was going to fry the board with the 360 degree heat from the soldering tip. I just left a time gap between soldering each header to let it cool down before moving onto the next one.

The first thing I did was to see whether I could get it working with an Arduino, and it couldn’t be any more simple. Check this page: RCWL-0516 microwave radar motion sensor for Arduino test and review for details. In essence you actually only need three pins for this to work. You need ground and vcc obviously, and then you just need to connect the ‘OUT’ to a pin on your Arduino. I believe you can attach the OUT pin to a PWM pin on the arduino, but I just attached it to pin 8 (a straight digital one) because that was good enough for my purposes. I uploaded the sketch (from the website link above) to my Arduino and sure enough, every time I moved, it triggered the LED on pin 13 on the board. I used a 10 k resistor on the OUT pin, which is overkill I think, but it was the only one I had to hand as I really didn’t want to go trawling through everything to find one. I think you’ll be able to use a resistor with a much lower value than that. In fact, I’ve read other articles where the author hasn’t used one at all.

Anyway, the next thing to do was to see whether I could power an ATMEGA328 from the 3.3v pin on the RWCL board. According to this link https://github.com/jdesbonnet/RCWL-0516, you could get 100ma over this pin. Only one way to find out! I set up the ATMEGA chip as you would normally do on a breadboard (there’s plenty of tutorials how to do this on the Internet, just Google it), and linked it to the RCWL board, with digitial pin 8 going to the OUT pin as before. Again I managed to get the LED on pin 13 to light up.

The next thing to try was to see if I can get a NRF24L01 chip running with the same set up, and after a day of trial end error, I managed to get a transmission working through my existing set up. Just need to refine the sketch now, but at least I got it working with the NRF chip which I wasn’t expecting to work given the small amount of power available from the 3.3v pin.

Will give a further write up and illustrations once I have done enough work on this to know it’s reliable.

LoRa32u4 by BSFrance.Fr (Blog Entry Part 1)

It’s early days for me with these devices at the moment, but  I have to say that I am impressed with their performance so far. For those who are not familiar with the LoRa32u4, they (and other flavours of LoRa devices) allow wireless communication over longer distances (than other wireless devices such as the NRF24L01), at least a few hundred metres through open air (I’ve read).  Hopefully this bodes well for the use to which I want to put these devices.

I am in the process of trying to replace a Raspberry PI Zero W as a gateway/base station for all the NRF24L01-based moisture sensors I’ve built for my greenhouse. I love the Ras Pi Zero W, it’s a fantastic piece of kit for the money and the WiFi has been absolutely rock-solid, but even though it uses less energy than the other Pi’s in the range, it still uses too much for my use, especially with the Arduino Uno plugged in to the USB port .

I’ve got an EC Technology 22 amp-hour power bank (which I can heartily recommend, they are brilliant power banks) which discharges in about 2.5 days with the Ras Pi/Arduino combination, and it’s just getting a bit annoying having to change the power bank every couple of days.

Although these LoRa modules are relatively expensive at the moment (around 12 quid from AliExpress), it appears that they would use much less power than my current base station, so it was worth the trade-off. I also would guess that these modules will eventually reduce in price when LoRa takes off a bit more.

When I ordered these modules, I forgot to purchase the little aerials you see in the image, but luckily I had some spare ones from a couple of Orange Pi Zeros, so that was cool. I’ve never been able to get the WiFi to work on the Orange Pi Zero, so that was okay.

Anyway, so far, I’ve uploaded an example sketch to the Arduino IDE (1.8.2) from Adafruit which used the RadioHead library with the RF95 set up, and it worked a treat.

I haven’t built my LoRa32u4-based gateway yet, that is to come soon, and I will write a post about it, but I did some decent testing to try and put the modules through their paces. I’ve noticed a slight issue when plugging the module into the power bank. The power bank would automatically switch off. This happened a few times while testing, which was a bit annoying, but when I plugged in the module at the same time as the Pi W, it didn’t switch off, which left me wondering if it’s using so little power that it’s falling below some kind of threshold and the power bank thinks there is nothing plugged in and switches itself off. Not sure about that at the moment.

But anyway, I got the module to ping the second module every second. The transmission is going through two housewalls, and three-quarters of the way down the garden about 20 metres away, and the modules performed flawlessly like this for two days.

So far, then, I am really happy with these modules. Hope this happiness continues as I build the circuit for my LoRa32u4-based gateway!

Realtime information from my car (Episode 2)

Welcome to the second installment! I made quite a bit of progress from the last episode and one small step backwards.  Once I’ve got something concrete together I will do a full tutorial

Over the last week I spent some time experimenting with all the technologies I’m using in isolation from each other, just to see if I could get stuff working individually.

First of all I saw whether or not I could get a 3G connection running. I plugged in the E1750 modem into the Raspberry Pi, ran a command to switch the modem to the correct setting.  After that, I downloaded the latest Sakis 3G script and ran the interactive script to generate settings for connecting the modem to the Internet. The most irritating part of this, once I’d got through the hassle of binding the modem to an RFComm port, was finding the correct APN settings for the EE network. I finally tracked them down to APN=everywhere, user=eesecure, pass=secure.

And hey presto, the Pi was connected to the Internet. At this point I was able to do all the usual stuff like running apt-get update and npm install -g node-red.

My next challenge was to try to get the Pi to connect  to a VPN. That’s for next episode.

Realtime information from my car (Episode 1)

I’ve been using the Torque Pro application with the OBDII port in my car for some time now and it’s performed perfectly. For people who don’t know what I’m talking about, Torque is an excellent application on Android to read the ODBII port in a car to retrieve useful information such as speed, revs per minute and much more. It’s served it’s purpose very well, but I got to thinking lately ‘how could I get realtime information to wherever I need it?’. Once I started thinking of that, it led onto ‘how could I track my car if it was stolen?’. I know you can buy this stuff off the internet, but I think the fun is in working out how to do it yourself. Not only that, if something goes wrong, you’re in a better position to fix it yourself, in my opinion. Plus, to a better extent, I can keep my information private, rather than sharing it wih a third party and all using open-source software.

So I had a big picture in mind

  • A system that can boot and configure itself without my interaction
  • A system that can start a 3G connection
  • A system that can automatically connect to the ODBII ports and start logging data
  • A system that can connect to a VPN for transferring data privately for further processing.

I don’t want to have to mess about setting up all this before I drive to work on morning, so I want all this to autonomously work.  I am not writing about this as a complete system at the moment, and is more of a journal of what I come across as I go about setting this. So there’ll eventually be a tutorial out the back of this series of posts, but I’m nowhere near there yet. As a phase two, I was thinking about having a touchscreen in there too, and a pi camera with face recog, but I need to get the basics done first.

I’m working on a bill of materials, and this is what I’ve got so far:

  • Raspberry Pi 3 (x2). One for the 3g connection and Node Red installation, and the other to control the ODBII flow. Wanted to use only one, but I’ve had a problem getting both the Pi 3 bluetooth and 3G connection to work on the same device, so I am taking the easy route for now
  • Huawei E1750 3G dongle for the 3G connection obvs.
  • Powered USB hub for the 3G dongle
  • USB Micro cables for linking the power
  • Internal bluetooth on one of the Raspberry Pi 3s
  • PAYG Sim card for connecting to internet
  • $4 Router for providing an access point in the car

Software-wise I’m think along the lines of:

  • Raspbian Jessie Lite (I can always install a GUI later if needed)
  • Node Red (with appropriate NPM libraries installed)
  • Sakis-3G for setting up the 3G connection
  • PyOBD-Pi for managing the OBDiI connection
  • Gammu for texting
  • OpenVPN for private data transfer.
  • MQTT for messaging

That’s about all I can think of at the moment, and I’m bound to add to this list. I will probably create some Arduino sensors such as  GPS, accelerometer, audio sensors and so on.

Anyway, stay tuned for episode two where I start piecing things together.

Now getting meaningful data from my garden sensors!

My father-in-law recently donated to me one of those thin plastic greenhouses, and although initially it was a bit flimsy, I managed to strengthen it a bit and safely store some plants and cuttings in there. At the same time I’d been trying to get some network-controlled garden lights working, but without much success.  I just couldn’t get the wireless function to work properly so I could control them from my mobile. The problem turned out to be a single stray line of code! I put a listening command in the wrong place, and effectively all my sensors stopped reporting to the base station. Anyway, managed to get that sorted, so at that point I remembered some two-year old moisture sensors I’d built, but never used in the garden where they were intended.

I reprogrammed the ATMEGA328 chip and burnt a 1mhz bootloader, stuck the chip back in the sensor and took it back outside. I fired up the base station again, turned on the sensor and lo-and-behold, I got some serial data over wireless to the base station which was running the awesome Node Red. I didn’t get too excited at this point because my previous attempts had faltered after a few hours. I came back to it a full two days later, and my sensor had successfully sent data for all that time every five minutes. Awesome!

I decided to brush off a bit of old Node Red work around recording sensor data, and link it to the work I was doing with the sensors. I used the new node-red-dashboard to present the information and there I had it; a sensor reporting live plant pot information every five minutes. I was well happy! Since then I’ve replicated my work and got four sensors working reliably with my base station with several more on the way. In the end, I got a nice-looking dashboard which gives me all the info I need. It was great to see the moisture levels change when the plant pots were watered.

Which takes me onto my task, automatic plant-pot watering without any involvement from me except topping up the water. I eventually want to scale up this to water barrels in the garden, feeding water to the various flower beds in the garden via a gravity-fed solenoid.

 

Greenhouse dashboard
Greenhouse dashboard