RFM12B-Linux and OOK/ASK and Oregon Scientific v3 protocol

The Owl energy monitor uses OOK/ASK via the Oregon Scientific v3 protocol. It looks like I might have to hardware hack my RFM12Bs to work with this protocol according to this article… Not ideal.

Receiving OOKASK with a modified RFM12B – JeeLabs Café – JeeLabs . net.

Although it seems there’s a branch of RFM12B-Linux which can do OOK already. I’m not entirely sure how this is going to work out, but I’ll keep posting.

I found some problems with RFM12B Linux, specifically it doesn’t work at all on the Raspberry Pi B+ 2. I’ve created an issue for this but I might be able to fix it if I can get some tinkering time. In the mean time I’m testing things with the original model B.

Top 10 Arduino Sensor Boards & add ons

I thought I’d put down a little list of my top 10 things I do with my Arduino boards at home. I’ve been experimenting a lot with ambient circuits, up cycling and things like that so you could say that these things are skewed towards that kind of thing.

  • Ultrasonic Sensors – be careful with these, I bought a pack of 4 from a dodgy supplier and the MAX232 chips had a bug which causes them to overheat rapidly and they get hot enough to burn stuff. You can use these in a lot of things, I’m currently using two as the eyes for a small robot I built to keep the cat occupied.
  • PIR Sensors – these are cheap and cheerful little blighters. Ambient circuits usually require some kind of human interaction, so ultrasonic and PIR are both decent ways to do that. Depending on how you direct them and mix them they can become quite an human interaction tool.
  • Bluetooth HC-06 – With speeds up to 250kbps the HC-06 is perfect for fast remote serial ports which can be accessed easily from a computer or android device. The HC-06 unlike the HC-05 is reprogrammable, you can hack it in various ways messing with it’s internal setup for the serial port. This is the fastest and easiest way to add a radio to a remote device that I’ve found, and I’ve tried NRF24’s, RF12’s, Wifi shields and other means. These are certainly in the category of just works(tm).
  • WS2811 RGB LED Strip – Unlike the 2801 the 2811 has individually addressable LED units, whereas the 2801 has 2 LEDs per controller. It works well with the FastLED library and lets you separate the LEDs onto individual faces of a 3D shape. They’re also significantly cheaper than BlinkM’s are and much easier to obtain in large quantities.
  • Gyroscope – If your project has any moving parts, it’s a good idea to put an accelerometer in there, it can give you feedback in interesting ways. Very useful to have on around.
  • MSGEQ7 – With no particularly easy way to say it, it’s an equaliser IC this little chip will take a sample of audio and tell you the value of it on 7 different frequency bands. It’s useful for doing things like defining colours to be illuminated in time with music and things of that nature. Microphones will need a little amplifier to get them working but it’s a genius little chip.
  • DHT11 – Another favourite of mine is the DHT11, temperature and humidity. You can connect these up to one of these mini arduino+rfm12b boards and you’ve got a thermometer and humidity sensor anywhere.
  • RFID Kit – This cheap and cheerful RFID kit can be used in all kinds of ways, creating proximity based installations or interactive spaces where each object in the space has it’s own unique ID.
  • Motor shield – There are tonnes of motors laying to waste because they’re not re-used, I collect them up and put them to work when I need one so a motor shield is always useful to have. Obviously you can always bang something together with a few transistors, but a decent motor shield for testing is always handy.
  • Screw shield – always handy to have around a screw shield can save a lot of time when prototyping.

Assembling and configuring a RAMPS with Prusa i2 (more or less)

To get what I need out of my 3D printer it was clear that the Gen7 although a great board to build was not going to be suitable for every day use.

I got myself a RAMPS and assorted add-on boards:

  • RAMPS 1.4 shield & Arduino Mega
  • LCD, SD & Click encoder combo
  • Lots of new wiring
  • An EEPROM
  • Bluetooth HC-06 module (already had this)

I bought all my wiring and connectors from We Do 3D Printing via eBay.
Excellent quality of cables and arrived quickly.

Step 1 – Rewiring

I use molex connectors to hook up to the motors, heaters and thermistors, so when replacing the cables for use with the RAMPS I bought some new wires and connectors that were suitable. The process of rewiring with the correct connectors which are fiddly little things is a journey I’ll leave to the imagination of the reader.

I wired a full set of cables for a RAMPS which includes:

  • Stepper motor cables, 4A, 4-wires, 3 in total (my z-axis splits at the molex)
  • Bed heater wiring, 20A x2
  • Bed thermometer wiring, 1A, 2-wires
  • Hot-end thermometer, 1A, 2-wires
  • Hot-end cartridge heater, 20A x2
  • End-stops 1A, 3-wires x3
  • Bluetooth wiring (simple level converter with 2 resistors)
  • EEPROM wiring (i2c port)

Step 2 – Programming the RAMPS

First you need to download the marlin firmware, after a bit of a straw poll it seems to be the preferred firmware for this combination of hardware.

git clone https://github.com/MarlinFirmware/Marlin.git

I you haven’t already you’ll have to install Arduino to upload the program to the Arduino Mega. The Marlin firmware opens without much argument in the latest Arduino IDE.

Now we need to configure the firmware by editing the configurations.h for each setup it’s a bit different, my screen required a lot of messing around to get working uncommenting ulti-panel and SD and other parts of the support.

Setup the LCD and click encoder, I wasn’t sure exactly how to do this at first but after a little toying around it seemed to work.

Step 3 – Building a power supply

Unlike the Gen7 the RAMPS doesn’t have an ATX port. I built an adapter for a PC power supply for the job, this means wiring up the thick 20A cable, (black for zero, red for +12V – RAMPS is sensitive to polarity so lets not mix this up ;)). We’re also going to wire in the 5V permanently on so we can get the PSU to power up independently.

The 5V always on power will also drive our bluetooth adapter so we can power on the printer over bluetooth.

We need to make sure that the servo line has 5V power because later we’re going to investigate auto-bed-levelling.

Step 4 – Powering on and testing

It’s a simple matter of pairing with the bluetooth dongle (keycode 0000)and interacting with the appropriate serial port. Once connected you can use minicom to issue commands to the printer and test the x, y, z.

Step 5 – Calibration

Measuring how far the printer is out of alignment and multiplying the result is the easiest way I’ve found for getting the x and y calibrated. The Z requires at least a few test prints to get anything better than a good estimation.

Once the X,Y,Z is calibrated then it’s a good time to level the bed, if you’ve got servos set up for auto-bed levelling the RAMPS & Marlin will allow you to retain the values after the first calibration otherwise it’s a manual job.

The extruder requires some extra attention to get working at exactly the right pace. Which will wait until a few test prints are done, and the callipers come out to measure things exactly.

Calibration requires tweaking some values in the Marlin configuration.h, this is a fairly well documented process.

OWL CM160 Energy Monitor with RTL-SDR

I have an Owl energy monitor model CM160, which has been mostly just acting as a real time monitor. In order to really USE the device I’m going to need to connect it to one of my running computers. At first I was using Eagle OWL on github. However it requires me keeping the LCD receiver and I want to eventually get rid of that, mostly because the only useful thing about it, the thermometer isn’t accessible over USB.

I decided that I should start experimenting around the 434MHz band with my SDR’s and see what I could come up with. After a bit of messing around installing the software for the RTL-SDR which I may cover in some detail in another post. I installed the rtl-433 tool from github. Unfortunately it didn’t work straight away, but I found some other people discussing various additions and even a fork tries to decode the owl sensor transmission. Non of the existing methods worked, so I wrote a patch and upstreamed it. So now when you download rtl-433 and run it like so, you’ll get this kind of output.

$ rtl_433 -f 433810000 -l 7000
Registering protocol "Silvercrest Remote Control"
Registering protocol "Rubicson Temperature Sensor"
Registering protocol "Prologue Temperature Sensor"
Registering protocol "Waveman Switch Transmitter"
Registering protocol "Steffen Switch Transmitter"
Registering protocol "ELV EM 1000"
Registering protocol "ELV WS 2000"
Registering protocol "LaCrosse TX Temperature / Humidity Sensor"
Registering protocol "Acurite 5n1 Weather Station"
Registering protocol "Acurite 896 Rain Gauge"
Registering protocol "Acurite Temperature and Humidity Sensor"
Registering protocol "Oregon Scientific Weather Sensor"
Registering protocol "Mebus 433"
Registering protocol "Intertechno 433"
Registering protocol "KlikAanKlikUit Wireless Switch"
Registering protocol "AlectoV1 Weather Sensor"
Registering protocol "Cardin S466-TX2"
Registering protocol "Fine Offset Electronics, WH-2 Sensor"
Registering protocol "Nexus Temperature & Humidity Sensor"
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Exact sample rate is: 250000.000414 Hz
Sample rate set to 250000.
Sample rate decimation set to 0. 250000->250000
Bit detection level set to 7000.
Tuner gain set to Auto.
Reading samples in async mode...
Tuned to 433810000 Hz.
current measurement reading value   = 140
current watts (230v)   = 2254

The output that I get on the LCD receiver is identical to the output I get on the terminal here. Take a note of the frequency I used on the command line. The last two lines will repeat about once per minute.

This first play around with the Owl’s radio was interesting, but I need to do more sterling work on this little hack. Firstly, the SDR is useful at doing other things so I can’t just put it in full time. Secondly, RFM12Bs are quite common, and I decided that I’d pick up a couple of them from eBay (434 and 868), and get a couple daughter boards for using with the RaspberryPi.

In combination, multiple temperature sensors like this one, a 434 or 868 Mhz central heating controller, a doorbell and some RF sockets will get a bit of the wireless treatment.

I still want to do more work on the mesh network with NRF24L01‘s but there are some particular challenges to simulating that which are bothering me at the moment.

KodiPlay safari extension for sending content to Kodi

kodplay.icon.colour.largeToday I resolved to stop using Google Chrome. The SSD on my MacBook Pro wore out a couple of days ago (warranty replaced), or destroyed itself in a fit of rage after 3-4 months so I’m going to try and use Safari only.

So, I use a bunch of extensions with Chrome, including Ad-Block Plus and HTTPS Everywhere, but more obscurely I need a way to push content to my Kodi installation.

I haven’t been able to find an HTTPS Everywhere plugin but I did manage to write a quick plugin called KodiPlay which you can download for Safari here.

You can find the code on GitHub.

The extension adds a toolbar button which will send the current content into the playing queue on your Kodi installation.

Supported content providers include: YouTube, Vimeo, DailyMotion, CollegeHumor, eBaumsWorld, LiveLeak, Twitch.tv, Khan Academy, Hulu, AnimeLab, ARD MediaTek, Freeride.se, Katsomo.fi, Ruutu.fi, Yle Areena, SoundCloud, MyCloudPlayers, MixCloud and even magnet links.

Just a quick post… ATX to RAMPS 1.4 board

Hacking an ATX power supply to work with RAMPS 1.4 is quite dangerous… Power supplies which can give you the Amps are rare.

ATX-RAMPSHere’s a nifty solution. A simple ATX power to RAMPS intermediate board.

Plug in an ATX 24 Pin power connector and two of the 4 pin molex power connectors (preferably from a dual rail supply). Wire them up to the output molex with the bottom pin of the output molex supplying the power for the heated bed.

The 5V and PS-ON pins can be wired to the RAMPS 1.4 to offer auto-power on (if like me you’re making a bluetoothy remote printer).

Download the Fritzing sketch here.

With this board, next time you blow up an ATX power supply, you don’t have to go through the process of hacking another one… Which increases the chances of electrocution each time…

24Mesh’N Quick Update

Just a quick note to say I’m almost finished with the majority of the 2.4Ghz mesh network classes. These are pretty solid classes at this point with a few minor missing features. I’m hoping to release something really useful really soon.

Goblin Teasmade Upcycle: Part 2

After the first stages were completed, that is, designing the new wiring situation and wiring the internals. The contraption now looks something like this

The wiring pattern was explained in the last post. So the things you see beyond the mentioned pin patterns are the wires for the i2c devices (ghetto pixel, and DS1307 RTC). The RTC is used to keep the time internally, there are some interesting points to consider about the clock face itself and how it will maintain time. More on this later…

Stage 5 – Building a Web UI.

The code for the Web UI can be found here on github. Obviously when you’re serving files from an Arduino via the SD card you want to keep the files as small as possible. After running ImageOptim and minifying the javascript and css It probably all comes in under 150kb. Which isn’t much but is still enough to make the poor Arduino struggle… The HTML code should be runnable in any browser and there’s a neat little clock UI that should make you feel good to watch.

Obviously, you don’t have a teasmade on your network, so unfortunately you won’t be getting a nice cup of tea out of it. Sorry.

Things to note on the Web UI are

  • Moving the cursor over the clock shows the kettle and teapot and their states behind it.
  • Pressing the right hand button makes tea… Well, I’ll mark that as WORKSFORME heh.
  • Pressing the left hand button turns on the light.
  • The freakin’ clock hands animate!!

Continue reading →

3D Printer updates… Why not use aluminium plate?

I’ve ordered a bunch of parts for my 3D printer, essentially to get it up to printing standards without difficulties with the controller etc… So yeah I bought a RAMPS 1.4 and a new arduino mega, and an LCD screen, all new wiring and some fresh PLA on a spool.

I also got to thinking about my warped x-carriage and what could be done about it. My first thoughts were to purchase a new one from 3D Hubs, but having a custom one printed was quite expensive. So instead, I looked at the thing for a while and concluded that I should just cut a replacement from aluminium. This isn’t difficult, aluminium is a very soft metal, it can usually be guillotined or cut with a junior hack saw or jigsaw. I’m opting for the jigsaw. I’m working on a template and once I’m ready to I’ll upload it to thingiverse.

Simply put the aluminium plate x-carriage will be made out of 3mm aluminium and will have 3 or 4 CNC bearings to keep it on the runners. In the middle I’ll cut a 2cm hole and drill holes for the extruder mechanics to fit on. This also made me consider the bed and what can be done with it. So I’m going to look into replacing the bed on the printer with an alu plate probably 4mm with 4 CNC bearings in. That will sit directly underneath the bed heater plate with some foam insulation between to keep the PCB stiff in the middle. I need to get some bending tools to make this right, as I want to have a fan holder and a built-in end stop tag for opto-endstops.

I’m looking for a 700W PC power supply if anyone wants to donate me one? There are a lot of these laying around that people don’t need and I’d rather not create more junk for the giant trash pile if possible to avoid.

Goblin Teasmade Upcycle: Part 1, The Teardown

Here's what the smart home used to look like - Goblin TeasmadeDo you remember the Goblin Teasmade? The device was a mechanical and electrical marvel, however very likely responsible for many a house fire, and probably entirely unsafe by todays standards. The teasmade was the epitome of the must have device for the middle class home of the 1960s, it even featured in the Queen music video for “I Want to Break Free“.

As I’m not shy of a challenge I decided to upcycle a 1963 model into a new fangled, Internet of Things device which can make tea over the web.
Continue reading →