Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By PaulRB
#26086 A more flexible approach that I would like to investigate is using AVR chips as i2c slaves. This would allow you have the same mix of digital IO, ADC & PWM that you would have if you were using the chip as your MCU. For example, an attiny45/85 would give only 3 usable pins (its an 8-pin chip itself), but you could choose various combinations of digital inputs, outputs, PWM and ADC. Step up to attiny44/84 and you get another 6 pins to play with. Choose an atmega328, and you have quite a few indeed! Plus you can attach any number of them to the same bus, by programming different slave addresses into each one.

You can program them with the same Arduino IDE you are using to program the ESP. You just need a programmer like USBasp (dirt cheap on eBay)

Another advantage is that the AVR chip could be monitoring sensors attached to it, accumulating or averaging data, running on very little current at a low clock frequency, while the power-hungry esp chip is in deep sleep. Occasionally, the ESP wakes and reads the AVR's collected data over the i2c bus and communicates it to the world.

The down side is having to program them in the first place. I looked around for a general purpose i2c slave sketch an did not really find one.
Last edited by PaulRB on Sat Aug 15, 2015 1:44 pm, edited 1 time in total.
User avatar
By eriksl
#26088
PaulRB wrote:A more flexible approach that I would like to investigate is using AVR chips as i2c slaves. This would allow you have the same mix of digital IO, ADC & PWM that you would have if you were using the chip as your MCU. For example, an attiny45/85 would give only 3 usable pins (its an 8-pin chip itself), but you could choose various combinations of digital inputs, outputs, PWM and ADC. Step up to attiny44/84 and you get another 6 pins to play with. Choose an atmega328, and you have quite a few indeed! Plus you can attach any number of them to the same bus, by programming different slave addresses into each one.

Another advantage is that the AVR chip could be monitoring sensors attached to it, accumulating or averaging data, running on very little current at a low clock frequency, while the power-hungry esp chip is in deep sleep. Occasionally, the ESP wakes and reads the AVR's collected data over the i2c bus and communicates it to the world.

The down side is having to program them in the first place. I looked around for a general purpose i2c slave sketch an did not really find one.


I have several of these combo's here, working. I came from AVR, I had ATmega's 328p lying around (NO ARDUINO!!!), first I connected enc28j60's for ethernet connectivity, later I replaced them with esp2866 for wireless network. And now I am replacing the atmega's altogether, because the esp2866 can do the job.

https://github.com/eriksl/atmega328p-ip/tree/esp2

Your approach is exactly the other way around... ;)
User avatar
By powerlord
#26091
eriksl wrote:
martinayotte wrote:The PCF8547 is 8 ports GPIO, there is no analog. (the potentiometer seens on the PCB is only there for LCD bias).

Also certainly no PWM.



sorry, you are right.

however, 8 more GPIOs for 1.50 and a nice breadboard friendly format - useful for ESP-01 projects where GPIOs are in short supply.

For ADCs, I've ordered a few of these:

http://www.banggood.com/CJMCU-MCP4725-I ... 86646.html