-
• #27
Is that 110mA with the GPS connected as well? Seems like a lot for just the Espruino!
Looking at the datasheet, I think the power draw will fall quite a lot when the GPS has satellites it's 'happy' with.
-
• #28
Just to add - I think the SD breakout will work, but you don't actually need one with level shifters (as the Espruino IO is already 3.3v volts)
-
• #29
Thanks Gordon, Yes that's the GPS attached too. I had it on for about 10 minutes and it isn't dropping. But last time I watched it it's quite happy to find more and more satellites. I don't actually have a problem with it trying to get more accurate location data.
The datasheet does say it has some 40mA or lower after about 12 minutes of tracking. I will test this tonight.
Something I couldn't work out about the SD adapters (I didn't look for long) is some have about 15 pins and others 7. Do some boards give a nice SPI interface and others break out the the pin such that I'd have to address everything myself/a fs driver.
As I understand it SD and is surface mount type is just a very basic chip that lets you address the flash directly, unlike fully driven pen drives or SSDs.
-
• #30
GPS Disconnected my pico sits at 30mA, that code setups up a serial port and has a print function attached to the data.
-
• #31
Ok, great - that's a lot better.
For basic SD cards (in MMC mode), all you should actually need (and all Espruino needs) is: GND, 3.3v, CLK, DI, DO, CS
For higher speeds (in proper SDIO mode) you can use two extra pins for data I believe (although Espruino doesn't do that right now), but I have no idea why others would have 15!
-
• #32
There are a lot of SD modules for arduino/etc like that, with a 2x8 row of pins; most of the pins are grounded. No idea why they did that.
-
• #33
I've got a 4AA battery pack, with the 2100mAH NiMH 1.2V cells that's 4.8v. Is that too much for the JST connector on the back? I'm thinking with it being less than a USB port voltage(5v) it should be ok.
Otherwise I'll make a 3 battery pack for 3.6v.
-
• #34
Do the 4
That power input good to BAT_IN, per Pico page, the Pico can take up to 16 that way (less if drawing heavy current from the 3.3v on the Pico, of course)
-
• #35
Yeh my bad, I've been skipping around the references pages so much. it's in the pico bullet pionts
On-board 3.3v 250mA voltage regulator, accepts voltages from 3.5v to 16v
The regulator being one of these http://html.alldatasheet.com/html-pdf/74620/MICREL/MIC5205/181/1/MIC5205.html as noted on the larger board power diagram.
I'm a bit paranoid with power. I've quite a few memories of plugging stuff in and it never working again. Same feeling you get when flashing firmware.
-
• #36
Hmm, I've only fried a processor once (An attiny84 on my BFFL*), when I put 30v on an input after a flubbed repair job when I burned the ground trace by powering it while it sat on a conductive surface. Other adc channels still worked. Dcdc converters, I smoked like 3 of them within a couple of months last summer on same project.
*big fucking flash light -150W
-
• #37
I'm a bit shocked how easy that was. So testament to Gordon there excellent work. Took a bit of figuring which pins my board meant by DO,DI and CLK but not hard.
I can't seem to write a line to the card once per second (2 seconds is fine) so I'm going to try appending a list in memory and flushing the list every few seconds. Hopefully it will sequentially write quick enough once it's started.
As this is a power thread
setInterval(function(){ console.log('Append'); fs.appendFileSync('testing.txt', "\tTest line\r\n"); }, 2000);
Sits at 29.6mA and blips to ~32mA to write.
-
• #38
Or it did work, after plugging in the GPS too now I'm constantly getting
ERROR: Unable to mount SD card : NOT_READY
. I unplugged it all again and got back to my test code but now I still get that error. -
• #39
Did you lose the call to initialize the filesystem?
Have you tried disconnecting it from all power, waiting a few minutes, and plugging it back in? I routinely encounter situations where a piece of hardware gets unhappy, and brief power cycles don't work (presumably because of the caps on the board?)
-
• #40
And - just realized that I missed something. You want the power on BAT_IN, not VBAT. With battery on VBAT, it isn't protected from the USB trying to charge the batteries (you're always protected from the batteries trying to power USB)
-
• #41
@JackBennett maybe you could try putting a decent capacitor across GND and 3.3v? While the regulator can supply the power it's possible that the power draw from GPS and the SD card makes the power line a bit unstable.
-
• #42
No I'm still stuck with
ERROR: Unable to mount SD card : NOT_READY
Here's my wiring
Here the code;var fs = require('fs'); // Wire up up MOSI, MISO, SCK and CS pins function onInit(){ SPI1.setup({mosi:B5, miso:B4, sck:B3}); E.connectSDCard(SPI1, A8 /*CS*/); } var text = "Hello World!\r\n"; function saveToFile(){ console.log('Append'); fs.appendFileSync('testing.txt', "\tTest line\r\n"); } //setInterval(saveToFile, 2000);
Here's how it executes;
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v77 Copyright 2015 G.Williams >echo(0); =undefined >save() =undefined Erasing Flash...... Programming 48640 Bytes................................................... Checking... Done! Running onInit()... >fs.readdir() ERROR: Unable to mount SD card : NOT_READY =undefined
I know the GPS is unplugged there by the way. I had it logging the GPS. I had it writing a like to a file. Now together I can't write to the SD and this first SD test isn't running.
I reflashed the pico too. same thing.
-
• #43
just a thought - what about connecting vcc on espruino to 5v on the sd card, and maybe disconnecting the 3.3v. The level converter may need power too
-
• #44
you probably did this,but i'd push the pico down further into the breadboard. I'd be surprised if it makes contact like that
-
• #45
Does the SD card still read from your computer?
Always good to check that with SD cards. They are incredibly unreliable. I've had 2-3 of them fail on me during use within the past few years. In one case I wasn't moving, and the song I was listening to on my cellphone stopped. In another, it was doing pretty much what you're doing.
-
• #46
I'll try another SD card as this one is out my very old phone. And I'll push everything down into the board more. The pins are quite long though.
I can read/write to the SD card in my PC and it's formatted with the SD formatter tool.
-
• #47
Well, then I doubt a different SD card would fix it... hmm.
-
• #48
I put in a new SD card low and behold it worked again. So I got quite excited soldered it up and tested it again and it was still working great.
Thought right nows the time for the battery. Disconnected from the PC I put in the 4x1.2v 1800mAH AA pack and the leds came on for things. Stopped it and went back on the PC connection without battery and now I'm back to
ERROR: Unable to mount SD card : NOT_READY
Very perplexing. I can't read/write to it at all now, tried formatting it and reflashing the espruino. PC read and writes fine.
-
• #49
I have a new SD reader now too so can't have been that.
-
• #50
Alas my deadline has come. I suspect it's some grounding problem when I'm not on my laptop on charge. I don't know enough electronics yet. I've yet to look at the SD source code to try and find a more helpful error message.
Thanks for your help guys. I'll keep working on it and try to have it ready for another time.
Hope fully this SD breakout will arrive in time and I can wire it up to the Pico.
I put my meter on the USB from my PC to the espruin and it's pulling a steady 110mA while blipping the LED and logging to the serial. I think I'll order a 3000mAh battery I've seen for a couple of quid more than the 1300mAH one that would have nicely fit in the case. Just for some peace of mind.
With some work on power management I bet this could get really efficient.