MicroPython on ESP32 with SPIRAM support

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Feb 21, 2018 5:06 am

Thanks ttmetro.

Yes especially since it only requires 2 resistors to make a voltage divider and problem solved.

I think that I will use a 10k and 5.6k as this will allow for measuring 2S battery on db11 and 1S battery on db 6 :)

User avatar
tuupola
Posts: 54
Joined: Sun Sep 17, 2017 12:10 am
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by tuupola » Wed Feb 21, 2018 5:52 am

Open separate thread about individual projects.

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Wed Feb 21, 2018 8:40 am

OutoftheBOTS_ wrote:
Wed Feb 21, 2018 4:05 am
My question is if I execute adc.atten(adc.ATTN_11DB) and hook the battery directly to the ADC pin without a voltage divider will it damage the ESP32 when the battery is above 3.9v ???
The voltage on any pin, including adc, must not exceed the power supply voltage (3.3V), so the voltage divider is certainly needed.
If you intend to run in low power mode (deep sleep), and don't want to waste power on voltage devider, you can use the circuit described here.

Very nice project, by the way. I would suggest a large ground plane on your final board, it will run more reliable.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Feb 21, 2018 9:25 am

Thanks for your help Laboris.

Please be patient with me as I am a noob. I only first starting to learn to program to help my son with his Lego mind storm(icon based language) a little over a year ago and discovered Python shortly after, I have only just started with hardware few months ago and all my learning is only by google.

I looked at your schematic to battery monitor circuit, can you confirm it works like this : R10, R11 is the voltage divider, R9 is to drain T2 to ensure it stays open, R8 pulls up T1 to ensure it stays open, when you set GPIO high it closes T2 that allows T1 to drain closing it to let voltage flow to the divider?? There r so many types of transistors I am still getting my head around how they all work.

Also I was wondering about the current drain on the battery if I just use a voltage divider with out all GPIO/transistors (to save the using of another GPIO pin) because if it is low it is unlikely to affect my robots much, as the motors tend to consume the loins share of power. That quadraped has 12 micro servos and can use easy 3amps when all 12 servos r moving at once. I have 2 x 2000mha 3.7v batteries in parallel giving me 4000mha

Thanks for advice on the ground plain. I did see that on my googling but haven't worked out yet how to do it with eagle cad. This is my very first designed PCB ever and first go at eagle cad. It will also make for less copper to etch out as well :)

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Wed Feb 21, 2018 10:19 am

@OutoftheBOTS_
You are right about resistor's functions.
You don't need to implement that circuit in your project (the power consumption wont be affected much by simple voltage divider), unless you implement some kind of power save feature (robot wakes up on some external stimulus).

I would support tuupola's suggestion to open the separate thread for topics not related directly to this thread.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Feb 21, 2018 10:09 pm

I apologize for the off topic questions this thread.

My very first ever post to this forum was to start a new thread and the reply I got was to not start a new thread but rather find a related thread to post too.

I joined the forum because I know little and need to learn answers to the what I don't know. I am sorry for posting so much on this thread but I have done it because it seems to be the place where I consistently get all the answers to questions that I have.

I think that I will also join the forum in your link to battery monitor circuit as this forum seems to have lots of answers to questions and it will break up my asking of dumb noob questions over 2 forums. :)

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 22, 2018 4:40 am

Ok this question is related to this thread.

I have brought a couple of 1.44" st7735 screens see https://www.ebay.com/itm/1-44-Colorful- ... 2212322440 as I want to use it as a info display screen for my snake robot that I am porting across from RPi to MP see https://www.youtube.com/watch?v=J5exLPEmNTE

I have hooked the little screen up as follows:
LED = 3.3v
SCK = 26
SDA = 25
A0 = 27
RESET = 3.3v
CS = 5
GND = GND
VCC = 3.3v

I typed the following into the repl

Code: Select all

import display
tft = display.TFT()
tft.init(tft.ST7735, miso=19, mosi=25, clk=26, cs=5, dc=27)
tft.rect(0, 0, 100, 100, tft.GREEN,tft.GREEN)
of course the back light is already lit up before any code is run. After I execute the code in the repl ther is no difference at all.

What am I doing wrong??

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 22, 2018 8:58 am

@OutoftheBOTS_

I've tested the driver only with the blue 1.8" 128x160 ST7735 boards from eBay.

You may try several options:
- use different display type: tft.ST7735R or tft.ST7735B (or even tft.ILI9341 for test)
- try to connect RESET pin to some ESP32 GPIO and declare it in tft.init() to use hardware reset
- specify the width and height arguments in tft.init() (128,128)
- the display has the 3.3V voltage regulaor on board, try to connect VCC to 5 V, also try to connect LED to 5V
- if connecting VCC to 3.3V, you can shorten the J1 jumper on board to bypass the voltage regulator
- if nothing helps, the display may not be ST7735 type, similar displays often uses ILI9163 chips

By the way, you may post here any question as far as I'm concerned. The suggestion about posting on different threads was only to make it easyer for other user to find some information. For example, your robot project may be interesting for many users not reading this thread.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 22, 2018 9:19 am

Thanks for your help.

The little board that I have has a voltage reg on the back and I am connecting VCC to 3.3v so this might be the problem as the 3.3v supply will be below the drop out voltage.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 22, 2018 11:17 am

I have had a bit of a play with the 1.8" ST7735 display.

There is a 0 resistor as a jumper to set if the LED is permit shorted to the 3.3v trace so this means that I can power the screen from the LED pin and not use the Vcc pin to cut out the LDO regulator. see pic
Image

I couldn't get to to work on the ESP32 using the display module in your firmware even when trying lots of different options as you suggested. So I though that I better rule out the screen not working so I hooked it up to the RPi and googled for a driver and found this 1 and after fixing a couple of typos it worked https://github.com/jackw01/raspi-python-st7735
Image
st7735.jpg
st7735.jpg (38.99 KiB) Viewed 18699 times
Making this screen work isn't a high priority but I would like to get it to work with the ESP32 at some point because it will be great to display if the ESP32 was successful of wifi login and display the IP as well as the battery status and another use info about the robot.
Attachments
rpi.jpg
rpi.jpg (58.34 KiB) Viewed 18699 times

Post Reply