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.

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 🙂

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 😀

Building an Electronic Load

One of the tools that I sometimes need but haven’t bought yet is an electronic load for testing circuits such as power supplies. Of course you can make do with fixed resistors (and I have so far), but you practically never have the right value/wattage to hand when you need to test something (in my case, usually on a Sunday afternoon…grr!).

The solution is a programmable electronic load, or basically an adjustable current sink (or a “reverse power supply” as some people call it) that can simulate the load from any fixed resistor within reason. I haven’t bought one of these yet, partly because I didn’t feel I needed it enough to justify the expense, and partly because I am rapidly running out of space to store instruments that are only used occasionally.

Some weeks ago I started toying with the idea of building one myself to at least get started. I’d seen some nice designs on Tindie, but wanted something that was capable of higher power and something which I could more easily tweak for myself. A bit of googling turned up a few promising pages, most notably this one on Kerry Wong’s (excellent) blog.

I liked Kerry’s design as a starting point, mostly because it is relatively well documented and the control code is Arduino (which I can work with). I therefore started revising the circuit to suit my needs and laying out a PCB for it as well.

Key changes from the original:

  • I’ve scaled it down from three pairs of MOS-FETs to two because that is what I could fit on the Eagle board (being constrained by the freeware version).
  • I’ve replaced the parallel LCD connections with I2C to simplify the PCB layout and free up Arduino pins.
  • I’ve mounted the controller (an Arduino Nano v3) onboard. That wasn’t the original plan, but the space was there so why not?
  • I’ve broken out a pair of analogue Arduino pins, a pair of digital Arduino pins plus a second I2C-connection that can be used for other purposes. Top of the list for me would be a real-time clock (RTC) module for data logging purposes and some sort of thermal sensing and fan control, but I am sure there are many other potential uses (web-interface anyone? 😀 ).
  • plus a bunch of other minor tweaks 🙂

This is still work in progress, but I have received the prototype boards in hand and I have started the assembly as you can see from the pictures. Still to do:

  • Do the mechanical work on the heat sink (in progress)
  • Rewrite the software to work with the I2C-display (also in progress, but might take me a while)
  • Test whether the damn thing works! 🙂

EDIT 13th March 2016: The schematic for my v1.0 PCB can be found here. There are at least two know issues that need to be corrected. 1) The “sense” pin (A3) is connected directly to the output but should actually have space for a voltage divider. 2) The spare opamp (IC1B) should have pin 6 and 7 connected together and pin 5 connected to AGND.

EDIT 19th August 2019: I’ve published the untested project files (with some minor tweaks) here if anyone wants to have a go at finishing this project themselves.

Tiny teaser…

Just a short “teaser” for one of my work-in-progress ideas, a (sort of) universal audio controller based on the ATtiny85 microcontroller (hence the slightly saucy headline…) and the Arduino IDE. It’s not ready yet, but some progress has been made.

The idea was to make something much smaller than the Ampduino and then make a few versions for different purposes. So far the “pipeline” consists of the following:

  • Universal motorpot controller, partly inspired by the controller I did for the Ampduino project.
  • Universal model with all pins broken out, to be used as the “brain” of a preamp or also (in the longer term) to control soft start circuits, clipping indicators, speaker protection circuits etc.
  • RX/TX version for remote control, although the RX-version may end up being something bigger based on a “full-on” ATmega328P like the Ampduino (and the normal Arduino boards).
  • Matching linear PSU if there is no other power supply required for a given circuit (or if a suitable aux-voltage isn’t available).

Current status is that I have hardware prototypes for most of these already (only the Rx remote receiver is missing) but as usual when there’s software involved that takes a bit longer for me to get around to and so I haven’t really tested anything yet. I have bought a couple of development boards for the ATtiny which seem to work well for testing and optimising code (which will be a definite requirement with the ATtiny-chips as they have fewer I/O pins and less memory than the ATmega-series) but I still need to get started on coding in earnest.

As usual there is no real timeframe for finishing these boards, but right now the Scandinavian summer is definitely working in my favour by nearly constantly bringing weather that makes you want to sit inside and code instead of being out and about 😀

tinypot-1

More Ampduino testing…

I am still making more tests with the prototype Ampduino board and everything still seems to be working OK. The only problem seems to be persistent issues either with the FTDI-drivers or the Nano board I am using – I have a couple of more Nanos on order though, hopefully that will help. Now, when I ordered the boards I ordered a few “extras” as well 😀

The first is a motor driver board based on the L293DD H-bridge driver. This (and the circuit) is nothing out of the ordinary – it is basically lifted straight from AMB’s implementation on the LCDuino-board, including the option for sensing the position of the pot using an analog input pin. What is a little out of the ordinary is that I made the board very small and included pads so it can be mounted directly to the back of an Alps motorised potentiometer. This seems to work well so far – the attached picture shows the board mounted to an Alps RK16816 for testing purposes.

The second extra is an I2C isolator board based on the Analog Devices ADuM1250. This chip can do isolation of an I2C-line and it supports both bidirectional communication and level-shifting (by means of different supply voltages for the two sides of the isolator). The board is tiny and can either be used inline or installed permanently on the Ampduino using an angled header that is soldered to the board. I haven’t put this together yet because I don’t really have an application for it until I start controlling DACs via I2C, but it looks very useful so thanks to Zwack at head-fi for the suggestion 🙂

Basically this means I now have the display functioning, an IR-receiver connected and working and the basic motor driver working – not bad I think 🙂 Further expansion of the Ampduino is also in the cards as I have a PGA2310-based volume control board in the works. Prototypes have been ordered and hopefully in a couple of weeks or so I can test that and see if the Ampduino can do SPI as well 😀

Ampduinos in the wild…

Now the AmpDuino project is starting to take shape 😀

I received the prototype boards yesterday and quickly assembled one to try it out. So far it has only been a very basic test with an I2C display and an IR-reoeiver and both seem to work without issues.

There are a couple of minor cosmetic issues with the boards and some of the connector placements might cause some problems later on (note the angled header for the SPI port – a straight one with a cable would probably block the USB port 😦 ) but so far it seems to be minor niggles only.

Programming-wise it also seems to be working well, apart from some annoying issues with the drivers for the FTDI USB-serial chip on my mac – they don’t seem to want to stay installed and working…

Next up is to do more testing on the AmpDuino itself and a few “bonus” boards I ordered as well, plus of course start building on the code base for the AmpDuino – stay tuned! 😀

The “AmpDuino” project

Since I finally realised that even I could probably benefit from incorporating a little bit of software in my otherwise purely hardware-based projects, I have been toying with the idea of building a more generic controller that could be used for many different audio projects. Obviously this is very much inspired by the LCDuino, the HiFiDuino and other similar projects, but I have tried to give it my own flavour anyway 🙂

The AmpDuino is a dedicated shield for an Arduino Nano v3 board. It incorporates most of the connections that would be necessary for audio-based projects while hopefully being expandable enough to be used for other things as well. The standard “breakouts” available are:

– Two I2C connections (display and one spare)
– Dedicated port for rotary encoder w/ push button.
– Two “trigger” outputs designed to be isolated via a PC827 optocoupler (which is of course optional)
– Three “general purpose” digital inputs/outputs (for IR receiver, IR transmitter or similar)
– Dedicated ports for interfacing with a motor driver for volume pots and sensing the position of the pot (shamelessly copied from the LCDuino…)
– SPI port for controlling DACs or PGA23xx type devices
– Power LED (if there is no Arduino mounted to indicate power)
– Reset terminal broken out to connector (although the Nano onboard RST can be used as well)
– 5VDC input with a another smaller connector that can be used for output.

The board measures 1.95″x2.3″ and is two layers.

I wanted this to be as compact as possible, but I have also deliberately based this on the Arduino nano instead of just the microcontroller on its own. The Nano boards are very cheap and having a “complete” Arduino available should make tinkering and tweaking much easier than having to mess with in-circuit programming etc. (ok, this may just be my irrational fears at play here ;)) I have also deliberately moved away from the LCDuino form factor, because a “normal” board can be positioned in many different enclosures. Using I2C for the display driver gives more options than just a standard 16×2 LCD. The I2C display connection also makes it possible to get rid of the LCduino’s port expander and still have enough digital pins for most applications (I think).

Discarded ideas:
– Onboard PSU (not really enough space, probably easier to add an external regulator depending what voltages are available already and how much current is needed)
– Dedicated port for IR sensor (could be done, but he current D1-D3 ports are more usable and will allow other usages as well (real-time clock etc.))
– Onboard components for the IR receiver. Could be done, but would mean the sensor would have to be mounted closer to the board, so probably easier done with an expansion module which has the sensor and the external components on the same board.
– Onboard SSR for power connections: Could be done (with something like a Sharp S202), but again it is more versatile if kept offboard.
– Onboard motor driver for volume pots: Not really enough space and would not always be needed. Instead, I have retained the basic connections and I am working on a dedicated board that can be soldered straight to the terminals of the motor on Alps pots (or at least that’s the plan)
– Real time clock: This is obviously a very nifty feature in the LCDuino, but I can’t see myself using it in many applications.
– Input selection: This is a tricky one, but initially I’ll keep it offboard. Anyway, for relay-based selection you can always “cheat” and send pulses to a 4017 instead. (hmm, probably should make a breakout board for this one…)

Any comments/suggestions? Is this a lousy idea? 😀

I am going to get some comments from people (diyaudio thread here) and then make the final tweaks to the board layout before sending them off for manufacture.

Photoduino (or not…)

After I started playing with the Arduino, it wasn’t long before I had a flash of inspiration. Why not use the Arduino to control my Canon 650D DSLR camera and then be able to auto-fire it based on inputs from sensors for sound, light, pressure etc. Since I wasn’t near an internet connection at the time I started drawing block diagrams on paper and even managed to come up with a snazzy name for the thing – Photoduino. Once I got home and back online, it took me around 20 seconds to find out that such a device – including the snazzy name – already exists 🙂

Block diagram of my camera controller idea (redrawn from the scrap piece paper it was originally on 😉 ).

Oh well, great inventors aren’t discouraged by minor setbacks like this and so I am going to persevere and make a better version of the same concept (or at least one I think is better). The basic camera control for a Canon DSLR like mine is exceedingly simple. It’s just a 3-pin interface for ground, focus and shutter where shorting one of the pins to ground will trigger the function – try it with a cable and a crocodile clip if you want 🙂

Trigger pinout for Canon DSLR

I do have some basic thoughts and requirements for what I think this thing should be able to do.

Hardware features:

  • Standalone unit for inside and (protected) outside operation (surveillance, wildlife shots, timelapses etc.).
  • Same board size as a 20×4 character LCD (so app. 10*6 cm) so they can be bolted together.
  • IR remote control for at least basic functions.
  • Support for internal and external power sources.
  • Support for as many different sensors as possible with external connections.
  • Outputs for controlling lights, flashes etc. as well.

Software features

  • Basic operation as sensor controlled trigger, remote controlled trigger, intervalometer and self timer.
  • Shot counter when running as an intervalometer.
  • Variable delay (positive/negative) for outputs to sync lights etc. with the camera.
  • Dimmable/defeatable display.
  • and a few other things that I will be able to add as the project (and my programming skills) evolve…

So, lots of things to get started on here – obviously I just need to come up with a new name first…

/U.