Update July 15, 2018
It has been said before and will be said again that I often refer to the Arduino Nano when I mean a copycat Nano board OR copycat Mini Pro. Let’s complicate this a little and add in variations using the 168 and 328 chips.
To clarify, I would not knowingly buy boards using the 168 chip – so that is out of the picture – and the main difference between the Nano and Mini Pro is that the former (usually) has a micro-USB connection whereas the Mini Pro has 5v TTL serial on a 0.1” connector , requiring an FTDI to program the board. The latter board is better if you are desperate to save power.
We should clarify this further: any boards that use the non-surface-mount 328 chip should be avoided as they only have 6 analog inputs. SMT variants have 8 analog inputs (A0-A7) and in any case are usually the least expensive (see AliExpress). I use two of those pins (A4, A5) as i2c pins (slave).
We’ve also discussed the SSSTM “Blue Pill” board (not Arduino”) but this continues to be unsuitable as an I2c slave peripheral at the time of writing..
See above, at the top is a typical Wemos D1-type ESP8266 board. Below are the Arduino Pro Mini and Nano variants I use.
And the point of these Arduino-type boards? The ESP8266 is a fantastic chip on it’s own, marvellous for WIFI and in my case for MQTT-protocol communications with a main controller such as a Raspberry Pi, FriendlyArm, Orange Pi or similar. My own software for the ESP8266 (ESP-GO) can run both PWM and RGB serial LEDs however, the PWM does not ideally co-exist with I2c and RGB if you need them all at once.
Enter the “Nano peripheral” which offers up to 6 (soft fade) PWM channels while talking I2c to the main board. Suitable pins for PWM (0-255) are 3, 5, 6, 9, 10 and 11. That AND up to 6 A/D channels (as I’m using potential 2 analog pins as i2c) whereas the ESP8266 has only 1 A/D. Add to that, more general I/O pins and more, all can be controlled from Node-Red on the main controller without customising the peripheral… i.e. out of the box.
Getting the Wemos and Nano working together is easy… a pair of 1k pull-up resistors for i2c to 3v3, a common 5v supply and you are done. It is not unusual for me to add in an ssd1306 OLED display to the i2c bus (no extra components needed). Right now on my bench is exactly that with the addition of a BME280+light sensor “weather board” on the ESP8266 side.
With these two puzzle-pieces pretty much standardised I can concentrate on the main control board and mobile software to make this all DO something.
Right now for the purpose of experimenting I have two RGB LEDs with common anode so I’m reversing values – 255 is off.
https://bitbucket.org/snippets/scargill/yR5nkB/nano-peripheral-ir-in-progress
https://bitbucket.org/snippets/scargill/kRg5o/nano-peripheral
Hi Pete, The part of the code that is setting up I2C device number on nano is confusing me a bit –
You are manually setting the checksum value to 0x3d. Say if I want my device number to be 12, how should I calculate the new checksum?
Just a minor update here on the state of the Blue-Pill (STM32F) I2C issues.
It has been added as the #1 issue on the “milestone” task list for the Arduino_Core_STM release 1.3.1. It’s marked up as issue #217, but #203 (logged by Squonk) is included.
>> [I2C] Review IT Rx/Tx complete callback Bug on going
>> #217 opened on 3 Feb by fpistm
So, don’t hold your breath, but it is receiving attention (and many thanks to “fpiSTM” for his work!!).
Resistive sensors, no good. Capacitive…. wired would be easiest. Not tried frequency counting yet.
Why not just switch to esp32? You have Pwm,adc,…. Everything there and no i2c code needed, no 2nd board and no 2nd source/project….
Another nice and cheap option if you only need endless amount of outputs is a shift register… Chain them up with nfets on the output pins and you can make up your firework controller for hundrets of rockets with just one esp8266….
Simple.. ESP8266 + Nano board total half the cost of an ESP32. No i2c software needed, already written. Nano at under £1.50 more flexible by far than shift registers and on a board with power, reset etc
Sure, a shift register is only a shift register. Depends on what is needed. But the price difference between esp32 vs 8266/atmega combo is so low, the time it takes to flash 2 devices, solder additional wires… I simply don’t care for the price difference
Anyway, we all make our own decisions 😉
i was curious what’s your reason for using this combo when one esp32 fits it all (e.g. using the pulse counter i could finally remove my last atmega used for soil moisture sensing which was not possible in the 8266 standalone).
And with just one chip the ota path can be used….
I OTA the ESP8266 and apart from rarely adding to the Nano (just added baud rate control) nothing to OTA there.
What about soil measurement do you need a more powerful chip for I wonder? Bluetooth? I used a Chinese Bluetooth soil sensor with light measurement etc.. good one, worked straight off a Pi, but ultimately the range and long term reliability of Bluetooth was no good for me, still working on that one, could end up with a capacitive sensor on the ESP but it’s DIY waterproofing.
usually not reading continuously from those sensors, but powering them, reading, cutting off power, will help preventing electrolysis and corrosion on the sensor itself
i’m using my own pcbs – capacitive, 3 parts on the pcb, completly isolated/waterproof (so no corrosion). as i’m not using it for pot-plants inside, but outside (including automated watering), i do not use ble, batteries or anything, but just connect them by wire (it’s just some meters….). the esp8266 could not decode the frequency, so replacement was a atmega counting pulses/frequency speaking via spi with the esp8266.
the esp32 has the pulse-counter, so currently i have 8 sensors and 8 frequency values, normalize them i’m done. the same esp32 still has enough gpio for valves, led, ultrasonic sensor and such…
been the resistive sensor-path as well…. i’m done with it, all the corrosion, swapping sensors every now and then…. nope. in my eyes that’s not a solution to a problem but a workaround that brings up new problems. capacitive is the way to go 😀
have you published details somewhere? Thanks
No, but the basic idea / schematic for the sensor can be found here: http://sgerber.de/2014/08/kapazitiver-feuchtigkeitssensor-fuer-blumenerde/
i got rid of most of the parts, so it’s just a capacitor and 2 resistors and the schmitt-trigger, and i re-sized it to fit on the cheap chinese 5x5cm pcbs – so it’s like 12€ for 10 sensors excluding the cable but including ic, c and r…. 😀
this needs nearly no power, connected of up to 10 meters with cheap/thin speaker wire (shield = gnd, left/right = 3.3v/signal), i feed the signal to a gpio on the esp32 which is mapped to the pulse counter.
so from softwareside it’s just to start the pulse counter, wait a defined time, stop the pulsecounter and get the counter value.
and the 3.3v vcc for the sensor could be provided by a gpio as well if running on battery (though the esp is basically a bad combination with battery…)
the nice thing about this sensor: i wrap it in shrink-tube, seal it up with some hot glue and bury it in the earth – works since some years now. with the cheap resistive china-sensors i needed 2-3 sensors each year.
if you want you can also use it as a human-proximity sensor as it’s so sensible that it detects your hand approaching as well 😀
Hey, I made my own capacitive soil sensors too. M ne uses a 555 timer clock and a rc circuit. I actually have it hooked up to a esp8266 that I am querying for the ADC readings every hour or so. Once it reaches a certain value i will have it turn on a small water pump for a couple of seconds.
i tried similar stuff, but it’s amazingly easy with 3 schmitt triggers (in one package), 2 R and one C… all in all it’s the cheapest version i could come up with so far 😀
though mine is not handy-dandy, i guess i save 80% of your soldering time 😉
and here’s the sealed version pulled out of earth just for you guys 😀
gr, with the edit the image dissappeared… so sorry… another post 🙂
They look fantastic for outdoor use, mine are for my girlfriends indoor plants that are a bit smaller. The bigger surface area available on yours makes alot more sense. Its also wonderful to look at a design i had never considered. Especially since i did a few days research and never saw anything about triple schmitt triggers.
interesting… could you explain the “theory” behind this concept? Why you need an oscillator to measure a capacitive sensor? What you get on the signal pin on arduino? Thanks in advance…
Sorry for the delay….
in the end it’s 2 schmitt triggers toggling load/unload of the capacitor (with the surrounding earth/air/… as dielectricum). the capacity varies with the moisture and defines the duration of the load/unload cycles. therefore it defines the frequency which you get out of this sensor.
and as we do not measure a voltage/resistor/current, the supply voltage, length of the wire from the µC to the sensor does not matter. power it with 12v. or with 3 volts… just stay inside the Vmin/max specifications 😀
there’s no current flow, hence no electrolyse which will change the soil and there’s no corrosion.
but – the challenge might be that not any µC is suitable for measuring frequencies (like the esp8266 is a bit sturdy…)
very interesting, thanks 🙂
Though my idea was only to make the circuit even simpler, the basic idea…. see the link i’ve provided somewhere above.
the form-factor is just owed to the cheap 5x5cm 10 piece pcb production sites…. and if i make them too small it won’t work once it’s isolated. so size matters.
when someone loves the kiss principle – keep it simple and stupid – this is like the olymp for me 😀
Just added baud rate control for serial out on the nano peripheral. Updated both IR and non-IR versions. Arduino source stored as snippets on Bitbucket.
There is 5v tolerance on both sides so dont worry about it. Both boards have 5v regulators but in both cases the chips run off 3v3.
On my Nano’s, and they are the same as your ones on the picture, the chip is running on 5V. I have measured the voltage on the pin VCC of the chip. This means all output signals will be 5V from Nano!
There is 3.3V coming from the CH340G only, better not using it!
The datasheet of the Mega specifies 1.8 to 5.5V as supply voltage(no problem on that side).
On the ESP8266 side I don.t see any specification that it can go higher on inputs but VDD +0.3V. So I assume all higher voltage will stress the skottky diodes with current from 5V to VDD. This will mean the input does not go higher then VDD + Threshold of Scottky diode which will be below max specs of ESP. The curent with 2.2k resistors is about 0.7mA which will most probablybe not harmful for ESP. Putting direct 5V on an input will destroy the Scottky diodes any probably damage the chip.
I never had any problem with 5V pullup voltage and that is actually used by everyone using your Nano concept. However I will try it with the 3.3V pullup voltage to see if it is reliable too..
Sorry for this critical comment, but these facts must be cleared after you changed your pullup voltage from 5V to 3.3V.
I2c pullups will not stress esp which according to the CEO is 5v tolerant
OK it is a bit more complicated! This ( https://www.ba0sh1.com/blog/2016/08/03/is-esp8266-io-really-5v-tolerant/ ) is the most convincing story about it.
Not at all complicated. You asked asbout i2c pullups and the voltage. I’m putting my current boards at 3v3. Both chips work at 3v3 so that’s fine. For years I put them to 5v without issue. You could use 5v if you are introducing something else which IS i2c and 5v based,
No matter 5.5V or 3.3V, the module eat 3.3V; If your module is 5V, 3.3V power supply is OK; While if your module is 3.3V, 5V power supply maybe case damage
Al ESP8266 and the 328s use 3v3 but most also have 3v3 regs s they can handle 5v.
Don’t buy 3v3 only modules if you are concerned.
Please clarify if this circuit diagram is still OK, because there you have pullups to 5V.( https://tech.scargill.net/nano-peripheral/) Is the AtMega328P and the ESP8266 working on 3.3V. I use the 5V now!