As I mentioned, I am trying to move my IoT development stuff to ESP32, and notably move from Arduino IDE to the native Espressif ESP32-IDF using mostly C.
This poses a slight problem. The development environments are sufficiently different that it is something of a pain in the arse to maintain both. Probably just about possible, but not simple. So I'd like to basically abandon the ESP8266 / Arduino stuff (I'll leave on GitHub) and start working only on the ESP32 based stuff.
This poses a slight snag as one of the use cases for this IoT stuff is a very small device placed inside a Honywell Galaxy alarm system keypad.
This is based on an ESP-01 module which is ESP8266 based. It is not ideal as not CE marked, no RF can, very limited IO pins, but it is small. It comes with a 2x4 0.1" pitch header and is just the right size to fit a Pololu 3V3 regulator between it and the PCB, which is rather neat.
This use case has the ESP-01, a 3V3 regulator, an RS485 SO8 driver, and a small 2x2 milli-grid header for programming and debugging.
The whole thing fits in the small space inside the keypad, as per the picture on the right.
As a result I assumed I'd be stuck with, at the very least, my keypad code on the ESP8266 / Arduino based code.
The other IoT devices are generally based on either ESP-12F, or preferably ESP-12S modules. These are only slightly narrower than the ESP32-WROOM-32 modules I am now using, and so easy enough to make alternative designs using the ESP32.
The ESP32, however, whilst larger, has a lot of IO pins. It is possible to track these pins so that you have quite a few usable IO pins, and GND and 3V3, all on one end of the chip if you try :-
I have actually tracked Tx/Rx programming pins, and GND and 3V3 "through" some unused GPIO pins, which allows its all to come out of the bottom end and keep the whole thing quite narrow. Obviously this is fine as long as I don't make those pins an output :-)
Once again, the new milling machine is doing a great job, and I was able to solder it.
And, to my delight, it fits, and the keyboard PCB fits over it with no problems!
So, yes, I can actually move away from ESP8266 now. I have to migrate and re-work the various tools and modules I have made, but once done, I can continue development on ESP32 only. Yay!
P.S. Always tweaking :-)
Showing posts with label ESP-01. Show all posts
Showing posts with label ESP-01. Show all posts
2019-08-15
2019-05-02
New life for old tech (Galaxy keypad)
I wanted to convert a Honeywell Galaxy alarm panel keypad to be on WiFi.
Simples :-)
Start with a keypad :-
Open it up...
There is not a lot of space...
(This had a proxy reader, which I removed)
We'll need a few parts, including a freshly milled PCB. All from GitHub.
No space for the spacer...
Fits nicely...
Not forgetting a wire link - sadly I could not manage a layout without this...
Add the RS485 convertor and power regulator and some wires, crop the leads nicely...
Looks tidy... (I then sprayed the bare copper with clear lacquer, by the way).
They keypad has handy 5V pads...
And the A/B wires...
And it fits in nicely...
Put back together...
And it works!
Simples :-)
Start with a keypad :-
Open it up...
There is not a lot of space...
(This had a proxy reader, which I removed)
We'll need a few parts, including a freshly milled PCB. All from GitHub.
No space for the spacer...
Fits nicely...
Not forgetting a wire link - sadly I could not manage a layout without this...
Add the RS485 convertor and power regulator and some wires, crop the leads nicely...
Looks tidy... (I then sprayed the bare copper with clear lacquer, by the way).
They keypad has handy 5V pads...
And the A/B wires...
And it fits in nicely...
Put back together...
And it works!
2019-04-17
Upgrading my Marsden M-125 scales to WiFi
I have some nice scales from Marsden, their M-125 column scales. I know they are not cheap (£235+VAT) but they are very good. If you are ordering for home you can ask them to allow stone/pounds as well as kg, which they seem happy to do. They work at 100g steps and can weight up to 250kg. What is nice is how consistent they are - none of this "best of three" effort on cheap bathroom scales.
But I wanted to get data out of them, and like proper scales they have a serial port (though it is a USB port). I was going to connect to a Raspberry Pi, and even have a Pi and a case, but I now realise I can WiFi connect them easily.
Using an ESP8266 in an ESP-01 package, I can receive the serial data and send over MQTT over WiFi, simple as that! It actually works out about half the cost of the USB cable alone - with the ESP-01 costing a whopping £2.75 from Amazon (more like 50p if you order from China).
It does involve adding a header to the main PCB, sadly (no doubt voiding any warranty). It would be nice if Marsden had a header on the board and did WiFi as an option. I am sure we (A&A) would be happy to provide some consultancy and custom firmware for such a project, just ask...
As for the software, well, I was actually able to use the Tasmota software as it will serial bridge to MQTT, but I then wrote my own (on GitHub). It sends via MQTT and/or via HTTP(s). It is a bit of a work in progress at the moment, but works well even so.
Here is how it is done...
But I wanted to get data out of them, and like proper scales they have a serial port (though it is a USB port). I was going to connect to a Raspberry Pi, and even have a Pi and a case, but I now realise I can WiFi connect them easily.
Using an ESP8266 in an ESP-01 package, I can receive the serial data and send over MQTT over WiFi, simple as that! It actually works out about half the cost of the USB cable alone - with the ESP-01 costing a whopping £2.75 from Amazon (more like 50p if you order from China).
It does involve adding a header to the main PCB, sadly (no doubt voiding any warranty). It would be nice if Marsden had a header on the board and did WiFi as an option. I am sure we (A&A) would be happy to provide some consultancy and custom firmware for such a project, just ask...
As for the software, well, I was actually able to use the Tasmota software as it will serial bridge to MQTT, but I then wrote my own (on GitHub). It sends via MQTT and/or via HTTP(s). It is a bit of a work in progress at the moment, but works well even so.
Here is how it is done...
2019-04-16
Arduino / ESP8266 / ESP-01 / ESP-12F
I never really got in to Arduino, which is kind of surprising given my history. I have been playing around with micro processors for a long time. 30 years ago I had a door entry system running on a home made wire-wrapped 6502. I have coded things from tote betting ticket machines to mobile phones, and much more. I did loads on the PIC16C84 which was amazing when it came out, but somehow the Arduino passed me by.
Of course, these days, there are the Raspberry Pi boards, which are similar in size and price to Arduino but powerful enough to run linux. I have used a lot of those. At the office we have loads running display screens, and doing things like network printers, and even the door entry and alarm system. Very powerful, but used generally as small network computers rather than hobby electronics with I/O. Even the alarm system uses the Galaxy RIO boards to do the I/O.
The coding is actually C++, which I have never been that happy with - but I am coping :-)
What is very impressive is the community of hobbyists that has built up. There are libraries for everything, so if you want, say, to use a Dallas DS18B20 temperature sensor, you will find a library to do that and examples, and instructions how to wire it up. Indeed, even the Tasmota code I am using on my light switches has that built in so I can literally solder a temperature sensor on the the pads and click a few config settings on the web page to set it up.
The libraries and examples mean that even Simon has been doing some impressive things, but he is not really a programmer, and so thought I might like a break(!) and spend a long weekend at his place.
In some ways this is actually a slight problem - I found there are many competing libraries for lots of things and it is not always obvious which you should pick. Of course, I am making some apps and libraries to add to that!
Of course, these days, there are the Raspberry Pi boards, which are similar in size and price to Arduino but powerful enough to run linux. I have used a lot of those. At the office we have loads running display screens, and doing things like network printers, and even the door entry and alarm system. Very powerful, but used generally as small network computers rather than hobby electronics with I/O. Even the alarm system uses the Galaxy RIO boards to do the I/O.
Arduino is stupidly easy
The Arduino eco system - the desktop environment - is really very simple and quite impressive. So much so that someone like my friend Simon, who knows bugger all about coding in C, is able to create working Arduino applications. It is impressive. The standard "Hello world" program is: (a) plug in the board, (b) click on arduino app, (c) type Serial.println("Hello World"); in the on screen setup() function, (d) click the arrow to flash... Done. In a few seconds you have a computer sending Hello World via a serial port. Making I/O pins do things is similarly simple.The coding is actually C++, which I have never been that happy with - but I am coping :-)
What is very impressive is the community of hobbyists that has built up. There are libraries for everything, so if you want, say, to use a Dallas DS18B20 temperature sensor, you will find a library to do that and examples, and instructions how to wire it up. Indeed, even the Tasmota code I am using on my light switches has that built in so I can literally solder a temperature sensor on the the pads and click a few config settings on the web page to set it up.
The libraries and examples mean that even Simon has been doing some impressive things, but he is not really a programmer, and so thought I might like a break(!) and spend a long weekend at his place.
In some ways this is actually a slight problem - I found there are many competing libraries for lots of things and it is not always obvious which you should pick. Of course, I am making some apps and libraries to add to that!
Hobby hardware
Back in the days of a PIC16C84 you could get chips with actual legs on and solder wires to them! These days that is impossible - the chips and components are just too small. What is interesting is that there are now common "modules" that have such chips, with extra passive components, all in place on tiny PCBs with headers. As always the headers are 0.1" (2.54mm) pitch so you can use molex style pins and plugs (or even wire-wrap).
I would always have bought parts from RS or Farnell but I was shocked at what you can get from Amazon. I mean, seriously, it is mental. And unlike RS I can get stuff same day or on a Sunday (which was handy during this long weekend). Seriously, it is like finding your corner shop sells electronic components next to the sweets counter, I can't get over it!
Sensors everywhere! What is impressive is the hobby electronic devices you can get, on PCBs with 0.1" headers, it is mental. If I was asked to list possible types of sensor, I would not come up with nearly as many as you can get, and get on Amazon Prime even! Here are just a few.
3.3V and 5V
One of the things that takes some getting used to is that everything is 3.3V now. When I were a lad it was all TTL (5V). But even now it is not that simple as some things are 5V still, so you need level convertors. That said, some things are 5V only and will not work on 3.3V, some are 3.3V only and are damaged by 5V, and some things are designed to work at 3.3V or 5V.
Interestingly the ESP8266 (see below) is 3.3V, but rumours are that the input pins tolerate 5V. Apparently the CEO of the company that makes them said so on facebook, and people say it works. What does not work is powering the ESP-01, or similar, from 5V as the flash chip gets fried. The right thing to do is read the data sheet and use level convertors as necessary. The good news is that 5V to 3.3V and 3.3V to 5V power regulators are now small and cheap and so are level convertors, so easy enough to do it right.
Power
Another issue is powering things - I have always had to use a power supply in the past, a plug-top and lead of some sort. But of course there are USB 5V connectors everywhere now. That said, the regulators for such things are tiny now. The Sonoff devices work of mains with a simple on-PCB power supply so for many things you could use one of those as the processor! Powering off 12V, or 5V, is simple and a small PCB with regulator. Even powering off 1.5V or 3V is simple as well. It never used to be this easy, cheap or tiny! Apparently you can make apps that will run off a battery for years if you try hard.
ESP8266
The breakthrough for me really is the ESP8266 processor. It turns a small(ish) Arduino board with Ethernet and a plug top power supply in to some thing truly tiny, cheap, and interesting. The ESP8266 is a small processor which includes WiFi (albeit only 2.4GHz). This is amazing. It is sold in various packages, but the interesting ones seem to be the ESP-01 and ESP-12F. It is this processor that is in the Sonoff light switches. There seems to be good support for them under the Arduino IDE.
ESP-01
The ESP-01 is the basic entry level package for the ESP8266. It seems some were sold with ½MB flash but now they are 1MB flash (there are two chips on the module, the ESP8266 and the flash).
They are tiny, and have an 8 pin header. There are a whole load of boards designed just to work with the ESP-01, such as relay boards which have an 8 pin socket on the board (and come with an ESP-01). They cost 50p or so if buying from China, but are around £2.75 on Amazon. So easy to use.
For programming there is a nice UART / USB board you can get, which has the 8 ping socket for an ESP-01. The trick is to modify it to have a button on GPIO0, which has to be pulled low as you reset to put in programming mode. Simply hold the button as you plug it in...
ESP-12F
There are a range of modules from ESP-01, ESP-02, and so on. The ESP-12 series is interesting, and they have taken a different approach in some of these later modules - instead of 0.1" headers they have solder tags on the edge so the module can be soldered on to a parent board.
The ESP-12E and ESP-12F are the same apart from the antennae, and include 4MB of flash (which is nice). The ESP-12S is quite new it seems and slightly smaller and does not have some otherwise useless pins on the end (used for external flash). They also have a metal can for EMC, and claim FCC and CE approvals, which is nice too. There are, of course, nice breakout boards that provide the 0.1" headers. The main advantage (apart from CE marking, and 4MB flash) are that more of the ESP8266 pins are available, including the ADC input.
For programming you just need to connect the pins from the small UART board (GND, 3.3V, RX, TX, and the GND via a button for GPIO0).
I'll blog on some of the projects I am making later in the week.
Subscribe to:
Posts (Atom)
Dodecahedron
I was shown a dodecahedron with LEDs inside. Looked great, so decided to have a go. The principle is not that hard - a PCB strip on the insi...
-
Broadband services are a wonderful innovation of our time, using multiple frequency bands (hence the name) to carry signals over wires (us...
-
For many years I used a small stand-alone air-conditioning unit in my study (the box room in the house) and I even had a hole in the wall fo...
-
This is an appeal for (sensible) comments. I am working on revised A&A tariffs for broadband. For those that are not sure how they wor...






















