MicroPython's I2C and SPI support
MicroPython's I2C and SPI support
I am new to ESP8266 and MicroPython but I see potential in both. I wonder how much support exists in I2C devices. I can write my library or code if necessary to drive a particular I2C device so I am interested in knowing how easy to access I2C bus.
For SPI I am only looking at SD card for the moment. I know I can save files on ESP8266's flash, which is very nice but I can't remove the flash and read its files on a computer so data should go on an sd card. How easy is it to access sd card? Any recommended reading?
For SPI I am only looking at SD card for the moment. I know I can save files on ESP8266's flash, which is very nice but I can't remove the flash and read its files on a computer so data should go on an sd card. How easy is it to access sd card? Any recommended reading?
Re: MicroPython's I2C and SPI support
Thanks. I glanced at the code. It's a snippet at best. So with the code I can write blocks, right? There is no file system support like arduino would on the sd card, is there?deshipu wrote: ↑Wed Oct 18, 2017 5:25 pmFor SD card try:
https://github.com/micropython/micropyt ... /sdcard.py
Re: MicroPython's I2C and SPI support
Looking good! Electrically speaking, if I have an I2C module made for arduino, i.e. with bus pullup resistors pulling to 5V, I need to disconnect them, correct? Do I also have to connect pullups to 3.3V or are they typically included on these WeMos or NODEMCU etc. boards?deshipu wrote: ↑Wed Oct 18, 2017 5:24 pmStart here:
http://docs.micropython.org/en/latest/p ... e.SPI.html
http://docs.micropython.org/en/latest/p ... e.I2C.html
Re: MicroPython's I2C and SPI support
The file system is built into Micropython. The file system requires a block driver to access a specific hardware, the sdcard.py is that interface. if you look at the docstring at the top of the file, you see examples how it is to be used. Once the fevice is mounted using this driver, you can use the standard python file system instructions.There is no file system support like arduino would on the sd card, is there?
Re: MicroPython's I2C and SPI support
Yes, you have to use pull-up resistors, and no, the are not such ones on the Wemos or NODEMCU devices, simply because GPIOs are general purpose. You may be able to run your external device at 3.3 V. Check that first.Do I also have to connect pullups to 3.3V or are they typically included on these WeMos or NODEMCU etc. boards?
Re: MicroPython's I2C and SPI support
Thanks Roberthh. I figured out from more internet research that there is no native I2C interface on ESP8266 so the support is bitbanging. I also read from another post that the pins are 5V tolerant so I can just use an ebay I2C module such as RTC that already have pullups on the breakout board.Roberthh wrote: ↑Thu Oct 19, 2017 6:50 amYes, you have to use pull-up resistors, and no, the are not such ones on the Wemos or NODEMCU devices, simply because GPIOs are general purpose. You may be able to run your external device at 3.3 V. Check that first.Do I also have to connect pullups to 3.3V or are they typically included on these WeMos or NODEMCU etc. boards?
Re: MicroPython's I2C and SPI support
Thanks Roberthh. I'll spend more time with my reading. It's good to know that there is a file system. I saw some nice and cheap wemos mini sd card shields for around $1. Will try them.Roberthh wrote: ↑Thu Oct 19, 2017 6:46 amThe file system is built into Micropython. The file system requires a block driver to access a specific hardware, the sdcard.py is that interface. if you look at the docstring at the top of the file, you see examples how it is to be used. Once the fevice is mounted using this driver, you can use the standard python file system instructions.There is no file system support like arduino would on the sd card, is there?
Re: MicroPython's I2C and SPI support, 5V Tolerant or not
This is a link to the related question on the espressif web site:
http://bbs.espressif.com/viewtopic.php? ... rant#p4100
It clearly states (in 2015) that the device is NOT 5V tolerant.
If you limit the current into the input, e.g. by a sufficient large resistor, the ESD clamping diodes may survive the stress. So people may come to the impression that the device is 5V tolerant. With a pullup resistor of 10k the inrush current if 14 µA, which may not kill the input.
Update: Another clarification is here, at page 27
https://espressif.com/sites/default/fil ... faq_en.pdf
http://bbs.espressif.com/viewtopic.php? ... rant#p4100
It clearly states (in 2015) that the device is NOT 5V tolerant.
If you limit the current into the input, e.g. by a sufficient large resistor, the ESD clamping diodes may survive the stress. So people may come to the impression that the device is 5V tolerant. With a pullup resistor of 10k the inrush current if 14 µA, which may not kill the input.
Update: Another clarification is here, at page 27
https://espressif.com/sites/default/fil ... faq_en.pdf