SMS Engine

I tried an ESP-12 but it didn’t work, and debugging was difficult. The GSM kit only works with the real serial, not the soft serial, so I couldn’t easily see what was going wrong.

So I switched to a raspberry pi, which was all much easier. I’ve not done much in python before but it was easy enough to get to grips with. There were enough helpful web pages explaining how to do different bits for me to be able to get it to work.

I’m not at the point where the SMS engine is working to send and receive texts, so it’s all web based work now.

SMS Gateway

During a conversation with the Order of Prayer it became apparent that being able to send and receive texts. I have an arduino with an old GSM Playground from Hardware Kitchen so thought that’d do.

I got the arduino working with the GSM Playground and an ethernet shield, and made a web tool to queue and receive texts via the arduino. Worked fine, but texts were limited to about 100 characters instead of the whole thing, and I couldn’t figure out why.

I saw on AliExpress that there were GSM kits available for a couple of quid. So I ordered one.

The first challenge was soldering SMD components, which I’d not done before. As it happens the only error was soldering up a through-hole and not being able to clear it, but it was a redundant ground connection so it didn’t matter. The spaces on the PCB didn’t match the component count though, so I had to guess at what to miss out. There’s what looks like a LED in the pictures on aliexpress, and the kit didn’t come with a LED so I left it off.

I’d read about problems with it not having enough power, so I used an old PC power supply to check it was working ok, teamed with an FTDI bridge (USB-Serial). I hooked it up and fired up PUTTY and, with a bit of learning around AT commands, got it working!

It needs BOTH the 5v and 3.3v lines powered. I had thought it’d be one or the other but no, it’s both.
I tied the mystery pin (labelled in Chinese on the picture on AliExpress) to ground and it works.

The AT commands are as follows:

TO SEND AN SMS

At+cscs=”GSM”
At+cmgf=1
At+cmgs=”phone number”
Message [terminating in ctrl+z]

TO READ UNDREAD SMS

At+cmgl=”REC UNDREAD”

DELETE READ and SENT SMS

At+cmgd=1,2

The next step is to pair it with an ESP-12.

IoT Doorbell

The three parts are all complete, it’s in place and working now.

Have some photos:

Development

This is the rig used to flash the ESP12.

Photo of the rig used to flash the ESP12

ESP12 with jumper leads

Chime

This now lives in my shed, powered by an external HDD which has a USB port.

ESP12 doorbell chime

Doorbell

This lives under the sofa so it’s audible in the living room and triggers other chimes.

IoT Doorbell Master

IoT Doorbell: The Doorbell

I already have a wireless doorbell which has two ringers, one is mains which I’m not prepared to mess with, and the other is battery powered so I’m happy to fiddle.

Rather than buying an inexpensive wifi module and reading the wifi signal from the doorbell itself I’m going to read the speaker +ve so that I know when it’s actually dinging.
I’m hoping to be able to slip an ESP12 (and voltage converter) into the small doorbell ringer, and power it from USB instead of battery.

Continue reading

IoT Doorbell: The Server

I need a server to be the central point of communications to and from the ESP12s. I have a single bay QNAP NAS box which has a web server on it which does the trick nicely.

I’m using MySQL and PHP, both of which are installed on the NAS box.

At the moment I have two pages. One called register.php which devices use to register themselves, and another called doorbell.php which sets the chimes off.

There’s a simple SQL table which has MAC (key), IP, name and a timestamp of when it was added.

Continue reading

IoT Doorbell: The Chime

My first ESP8266 project is to extend the wireless doorbells we have. The idea is that I’ll hack the portable unit to make it run from USB and add in wifi capability so that when the doorbell is pressed it’ll tell the network.

This project has three parts: the server, the chime, the doorbell.

This post is about the chime.

The Chime

Continue reading

ESP8266

I’ve started playing with ESP-12s.  I have a NodeMCU development board and three ESP8266MOD (ESP-12) boards.

I’m using the arduino IDE to program, which makes it super easy.  The only difficulty I’ve faced so far is getting the ESP12s to run after flashing.

This is a quick summary in case I need to refer to it again later:

Flashing

To flash, you need to wire it up like this:

[stolen from here]

I thought this would involve solder but it doesn’t – jumper wires through the holes works fine. Single core wire is slightly better as you can bend the end round to prevent it falling out.
With that wiring there’s no faffing with a reset button, it boots straight into upload mode.

Running

This is where I came unstuck and it took me a while to figure this out:

  • EN (marked CH_PD above) needs to stay pulled up to 3.3v.
  • GPIO0 needs pulling up to 3.3v via a 10k resistor.
  • GPIO15 needs to be pulled to ground (leave it as it is).
  • TXD and RXD can come out.

Getting moving

I have made a breakthrough (for me at least) in computer control of the railway.  I have an arduino which controls power to the railway, making a locomotive go or stop.

This is achieved using a rotary encoder (a knob, in short) and a MOSFET.  I’ve not got it to reverse direction yet, when I do I’ll post pictures and code.  I’ll be doing that using a H-Bridge chip if I have one, or a DPDT relay.  For power I’m using an old PC power supply unit, which helpfully has 5v and 12v supplies – 5v for the Arduino, 12v for the locos.

I bought a couple of mosfets, relays and some other bits from bitsbox.co.uk who sell components in low quantities at reasonable prices.

What’s all this then?

This is a space for me to witter on about the stuff I’m doing with a model railway and an arduino (other micro-controllers are available).

 

This is what it looks like so far:

starter for ten