ESP/Arduino accessories…

As I’ve spent more time working on my “IoT-T” design – I really should publish the files for that soon – I’ve found myself making a few additions to the main board. They are small extension boards that add functionality without cluttering up the mainboard – in no particular order:

– Different breakout boards to convert the I/O pins on the board to screw clamps for prototyping use or for easier connections.
– Board to add opto-isolation to a pair of digital out pins.
– A smaller watchdog timer to reset an IoT-device that is located remotely in case it freezes up for some reason.
– A breakout board for DS18B20 “One-Wire” temperature sensors.

Alone these boards are not really very impressive, but as extensions they really add to the versatility of the IoT-T main boards and they allow the mainboards to stay simple and universal. Of course these add-on boards can also be used for straightforward experimentation and prototyping, so I’ll be building a few extras to keep on my desk as well.

Project files: Electronic Load files (untested)

My post on Kerry Wong’s electronic load continues to be one of the posts that consistently drives referrals and traffic to the site, even four years on from publishing it. I guess this is more of a testatement to Kerry Wongs’s original idea and design than to my efforts, but it also means that regularly someone will email me and ask what happened to the project. For the last few years I’ve only really be able to answer “not much more than what you can see” and “no, I am not expecting to do anymore about it in the foreseeable future”.

However, I have been thinking that I should get a grip on myself and at least package up my design files so that someone else might be able to carry the project forward forward. Last week another email from a reader managed to prod me just enough that I finally relented and started doing just that, so here I am publishing something that I generally do not like – a completely untested design. However, i do hope that someone can continue with the design and get it tested and running because I’m sure it is worth it (and if at some point I need a load myself, I will be grateful that someone else has done the work 😉 )

Read more of this post

Experimenting with ESPs… (part 2)

One of the few projects that has moved a little lately is my ESP-based IoT-experiments (which started here). As mentioned then, I had just managed to crack how to do the mains-powered PCB layout I originally wanted to make so that’s what I have been spending time on building and refining since. Having a mains-powered board makes more sense when you need mains power for a relay anyway, otherwise a plug-in USB supply is just as good (or actually better/safer). The board is shown here in full prototyping mode, it is going into a case – of some sort – very soon.

Apart from adding mains power to the board I also removed the original DHT22 sensor and replaced it with an off-board BME280 instead. That was super smooth and it works even better than the DHT, not to mention that it also measures barometric pressure. I’ve been looking at other sensors as well (UV, air quality, light intensity etc.) but they don’t really make a lot of sense for my immediate application (which is remote monitoring of temperature and humidity in my basement).

Since I finished my original version I’ve made a few enhancements to the software and so now I’ve got the code for both LCD and web-UI mostly finished and especially the web part was a great learning experience. As mentioned in the previous post, it’s also a learning experience I am not sure I would have been able to complete without the help of the excellent ESP- and Arduino tutorials by Rui and Sara at Randomnerdtutorials.com, so obviously very grateful for those.

Now I can still do more improvements to the software but instead of picking at it for another six months I think I’ll try and package it up shortly and then publish it here so that someone else can hopefully have a go at it as well. Stay tuned! (but as usual, don’t hold your breath while you wait…)

Experimenting with ESPs… (part 1)

…ESP8266’s that is (if you hadn’t guessed that 🙂 ).

Although I am not directly involved with it, I have several colleagues at work that are looking at Industrial IoT applications for various use-cases. Quite a few of them have built personal home-automation systems of one sort or another, and as I would actually like to do a ittle bit of monitoring/control around my house as well I started looking at options a while back.

My old Ampduino project was of course a big inspiration, but the Arduino lacks onboard wifi which is a big drawback, even for “IoT” at home, and so the ESP8266 was a very logical step up. The original plan was to build from scratch using “raw” ESP-12 modules, but after a bit more research I stumbled upon the Wemos D1 mini. I then decided to go back to the original “Ampduino” approach of building a baseboard for a ready-made module instead. This gives a good amount of flexibility while at the same time ensuring that USB, programming and all other standard functions work as they should.

For once, I decided that I was going to get started on the software-part of this immediately (that’s usually my weak spot) and since I have had to wait three weeks for the fist PCBs to arrive I’ve made very good progress. Two things helped me along though: Firstly that I found a basic sketch at RNT that did a rudimentary version of exactly what I wanted, namely control via a web-UI. Secondly, I had a standard NodeMCU-board which I could pop in a protoboard immediately. That made it feasible to start getting individual pieces of the code together as soon as the PCB-order was submitted and then subsequently assembling the pieces of code into the “real” thing later on. My prototyping efforts while the v1.0 boards were in the mail also gave me input to v1.1 boards, so I can actually start placing those orders in a couple of weeks (no point doing it now because all the PCB factories are closed for Chinese New Year).

As usual for this type of project I’ve ended up making several versions of the board. The “original” version is USB- or DC-powered and has an onboard relay and an onboard DHT22 temperature/humidity sensor in addition to a couple of spare in/outs (analog/digital). The smaller version shown here ditches the onboard relay and instead breaks out a full set of SPI-pins. This allows connecting an SD-card adapter so that data from either the onboard DHT22 sensor or any of the other inputs is saved to a local card as well as being displayed on a web interface and a local LCD/OLED display (via I2C).

The original plan was to do a mains-powered version but I couldn’t get a good design together at the time and so I went DC-powered instead. However, I think I’ve cracked it now so the next run is going to include a mains-powered version as well. Other changes for v1.1 will be some routing improvements and (most likely) doing away with the onboard DHT22-sensor and replacing it with the option of one or more offboard sensors based on the BME280 and/or the DS18B20 sensors.

Board sizes are from app. 50-75mm squared, so these are quite compact and versatile. More updates and also some code samples later on 🙂

Distractions….

Once again I find myself in a period where “real life” is intruding significantly on my build time. Not only at work (which is the normal reason), but also in my personal life. Therefore, the progress I am managing on my projects is mostly so incremental that it doesn’t really make sense to write about it – it would be the DIY-equivalent of a book with every page as a separate chapter!

However, the inspiration for projects is still there and both the various online forums and my blog-feed serve as good sources of new ideas and inspiration. One recent example that I specifically think is worth mentioning is this post on Arduino “watchdog timers” for standalone Arduino projects where a self-reset capability in the event of an error is a good idea. Like all the other posts on the site, this is very comprehensively documented and easy to follow and in this case it’s a topic that I didn’t think about but immediately thought would be useful.

And the best part is that even if you are busy, sketching out a simple PCB doesn’t take that long – does it? 😀

(note: hat-tip to the referenced wikipedia-article for the image below)

Switched on?

Another project that’s been on hold for a very long time because I did not really need to finish it….

It’s a balanced two-in/two-out passive switch box which I intend to use partly to add an additional input to a spare amp, and partly to build a more comprehensive test setup for comparisons of sources and amps.

The signal switching is done via relays (see here for original post – oh how time flies!) and the power supply for the relays is an IRM power supply module as showed a few weeks ago. Switching of relays is done with latching button switches that I still need to wire up once the front panel is drilled and that’s about it really 😀

The relays are transistor controlled and 5V types, so while it is simple for now there is plenty of scope for adding functionality via an Arduino/ATtiny-based controller of some sort. The most obvious feature would be an IR remote control, but another thing I was originally thinking would be to add ABX-logic to try some blind testing. I sort of gave up on figuring that out, but if anyone knows how to build this in Arduino code give me a shout 🙂

More ATtiny experiments…

Since I managed to breathe life into my ATtiny-based speaker delay project I’ve been working on more ATtiny-based boards. There are many potential applications I can see (if I look hard enough…) for a small SW-based controller and that is what I’ve tried to build. The hardware was done a while ago, but the software was lagging (and still is somewhat).

I also received my TinyLoadr programmer a few weeks ago and it was definitely worth the wait. I’ve mounted the board to a piece of aluminium to keep it stable and now its more or less a perfect tool – very highly recommended if you want to play with ATtinys!!

To speed up my development cycle I’ve build a prototyping setup with a ZIF-socket and a solderless breadboard. I’m not a fan of solderless breadboards in general, but they do have their occasional uses and this would be one of them. I bought a few small ZIF-sockets from ebay and together with the tinyloadr programmer they make up an excellent prototyping platform. Swapping ICs from one ZIF to the other is still a bit of an annoyance, but it’s far more flexible than the alternative 🙂

If you need more memory space (or more I/O-pins) than the ATTinys can provide then I am also working on an update of my AmpDuino-concept. This will be a fully-fledged controller based on a stand-alone ATmega-chip that can do the same as the old version AmpDuino, but in a more optimised way. Connections etc. will be laid out for what I consider to be typical audio applications. ETA is, as always when there is software involved, unknown 😀

Project files: ATtiny-based power delay

As the PCBs for my next ATtiny-based designs have landed over the weekend and I am back from my holidays, now seems to be an appropriate time to post this 🙂

What is it?
It’s my ATtiny85-based power delay controller which can be used for speaker protection etc. as described here. In addition to the controller board itself are also a couple of relay boards to do the actual signal switching. One board is stereo and based on 10A relays, the other is mono and based on a 30A relay.

The controller board includes an on-board 5V regulator, an LED coupled directly to the ATtiny to indicate when the relay is engaged (or another purpose) and two FET-switched outputs. The last two ATtiny I/O pins can be used to trigger the chip with buttons, sensors etc. which gives tremendous versatility.

How big are the boards?
All three boards are my “industry-standard” 2”x2” (app. 51 x 51 mm.) in size, meaning they can be stacked on top of each other if needed.

What is the status of the boards?
All three boards are version 1.0 and the prototype boards looked and worked as expected.

Does it use any special/expensive/hard-to-find parts?
Nothing serious this time either 🙂

  • The small heat sink for the regulator is a Fischer type SK95 with an M3 hole in the bottom, but if you’re having trouble finding this there should be plenty of other small heat sinks that will fit. In any case, the heat sink isn’t always required, it depends on your input voltage and current draw from the 5V line.
  • The relays are standard types, either Omron G5LE (small board) or Omron G8P (large board). I’ve quoted Omron part numbers to give you something to go on, but there should be plenty of identical replacements from other manufacturers available.

Anything else I need to know?

  • The intention is that the ATtiny chip should be programmed using the Arduino IDE. That means you need to have either a dedicated programming shield for ATtinys or wire up the chip to an Arduino board that is used as an ISP. You also need to have the ATtiny cores installed in your Arduino IDE (see explanation here) and you have to burn the Arduino bootloader onto the ATtiny yourself before filling it with the actual program.
  • For programming, I highly recommend something with a ZIF-socket because it will make the whole thing much easier. I’ve got one of these on order (which recently came back in stock) because that looks brilliant, but there are shields on ebay that can be used as well. I’ve been working with this one so far and it works well, but of course you need a dedicated Arduino board to run it.
  • As you can see from the schematic, the intention is that the controller board is fed from a higher voltage (9-24V) than the ATTiny requires, in order to be able to use relays that draw less current. The onboard regulator will provide the 5V that the ATtiny requires.  If you are using the big mono relay boards, be aware that the worst-case power draw for these is around 1.2W each. This means that if you are using a pair of 9-12V relays here you’ll need to be sure that your power supply can handle that.
  • The second output is intended as just that – a secondary switch – but since it’s connected to one of the ATtiny pins that provide a PWM-output, you could probably do something clever and use this for controlling a variable-speed fan fed from the same voltage as the relays. If anyone does that I would love to steal, ehm…. borrow your code 😀
  • Although the relay boards have on-board protection diodes across the coils, there is also space for optional SMD diodes on the bottom of the controller PCB. Use these if you’re driving off-board relays etc.
  • There is a sample sketch included in the download file, but please don’t laugh (too loudly) at my pitiful attempts to code – it’s just an example 🙂

Downloads:
Download design files here

Related information:
Note: Always read the “intro post” for additional important information about my designs.

Most of the complexity here is around the coding. There are tons of links available around the web for how to use ATtinys with Arduino, so I’ll not list them here. Start from the link to the official Arduino page and then do your own search from there.

Delayed delay…

Was going to post something else today, but as I managed to finish something that includes software (which happens very rarely) I had to show that instead 🙂

It’s a small delay-circuit, useable for amplifier muting etc. via external relays. Nothing new in that as such, but unlike many other such circuits this one is based around an Arduino-enabled ATTiny85 microcontroller. This means that in addition to basic mute-on-startup functonality there’s room for expansion as well, including connecting external sensors etc. to the board.

The (laughably) basic Arduino sketch that I have just made to do mute-on-startup and read a manual mute-switch for control is less than 1kB in size, so even with just 8kB of memory on the ATTiny there’s still quite a bit of room to add software-based features to suit any particular application.

In terms of hardware, the board includes FETs for driving the relays, a separate indicator LED attached to one if the pins on the ATTiny and also a 5V power supply. The board is wired so that the relays are driven from the raw input voltage with the FETs acting as level shifters. In the standard configuration there is two I/O-pins left for control purposes, but with a bit of hacking it’s easily possible to repurpose either the LED connection or one of the relay driver pins if required.

I have a few other ATTiny85-based projects where I have done the hardware ages ago, but now with a (modest) success under my belt I feel much more inclined to start developing software for those as well 😀

Project files: A PGA231x Volume Control

What is it?
A “digital” volume control based on the well-known PGA2310/PGA2311 ICs from TI. These aren’t actually digital, but just digitally-controlled resistor attenuators integrated on an IC – which doesn’t really matter anyway.

As is often the case, there are two board versions: One is a “normal” stereo version with a single PGA chip onboard, the other is a balanced/multichannel version that has two chips onboard (for balanced setups) and the possibility to daisy-chain more boards (for multi-channel systems). The boards are intended to be controlled from an Arduino or a similar microcontroller via an SPI-interface. I haven’t included any software in the download file, but there should be plenty of examples online that shows how to do this integration (especially for the Arduino).

As even the not so keen-eyed observer will notice, this isn’t a new layout. I recently realised I didn’t post these before and as the project they were meant for died somewhere along the way I am not sure I’ll ever pick these up again (at least not within the foreseeable future).

Note: I had some minor noise-issues with the boards. As I never got beyond bench-testing, the noise could be from any number of sources other than the layout (my shoddy test wiring, poor PSU, the poor USB supply that I used for the arduino etc.). This means that although the PCB layout is made according to (what I believe are) the TI recommendations for the PGA231x, I cannot guarantee that the finished board will perform 100% flawlessly without tweaks.

How big are the boards?
The stereo board measures 2.525” x 1.6” (app. 64 x 41 mm.)
The balanced board measures 2.525” x 2.65” (app. 64 x 67 mm.)

What is the status of the boards?
The boards are v1.0, meaning finished and technically working as I expected. Please do note the caveat above around noise though.

Does it use any special/expensive/hard-to-find parts?
None, really.

Anything else I need to know?

  • There are plenty of examples online for interfacing the PGA ICs with Arduino and other microcontrollers – do a search of diyaudio and the Arduino forums for a start.
  • The PGA chip wants to be driven from a low-impedance load and the input buffer sees to that – use whatever dual opamp you prefer here. If you don’t have a favourite already, I’d recommend the LME49720/LM4562 as long as they are available:) The PGA has a buffer of its own on the output and it is spec’ed to drive loads down to 600 ohms which should mean that all common configurations are catered for.

Downloads:
Download design files here

EDIT 23/4-2017: In response to the reader comments below, here is a basic BoM for the single board. As the dual-board is basically two sections of the same circuit, you should be able to work out the BoM for that yourself 🙂

Related information:
Note: Always read the “intro post” for additional important information about my designs.

Please also refer to the data sheet for the PGA2310 for information about controlling the chip etc.