Newbie question here but I can’t seem to find any documentation on this. Do the GPIO pins normally go high on bootup of the device? I have a relay connected to pin1, set as a digital output and when I connect power to the device the relay always activates for about 5 seconds while the imp starts up. After that it goes low and works like I expect, but I can’t seem to figure out how to avoid the pin going high each time the device reboots. I’m hoping that I’m overlooking something stupid, thanks.
No, but they are tristate. This means they can drift anywhere depending on leakage. You likely want a physical pull-down resistor on the pin (eg 10-100k)
Ahh, that would make sense. It does float high at about +.8v on bootup… however I can’t find a resistor value that will both keep the pin low enough on boot and also allow the pin to trigger properly. I even tried a pot to dial it in. I guess the transistor in my circuit must trigger at really low voltages. My lack of professional education is showing, but I’ll figure it out. Thanks!
Do you have a resistor in line with the base of your transistor?
Resistor on base doesn’t effect it I’m afraid. I’ve tried every possible combination of resistors on the pins with no help. If a resistor value is appropriate to keep the pin from triggering a connected transistor on boot then it also prevents any triggering of the transistor during normal operation.
So I decided to just strip everything off the imp and test. I’ve found that all the GPIO pins go high to V+ for a few seconds on bootup of my device. Can anybody else verify if theirs does the same thing? Could mine be defective? Is there any way that the board could affect this?
Thanks for your help.
The pins shouldn’t go high at all on bootup; they stay tristated until code configures them (this is something which is obviously very important, hence I’m stating that with a lot of confidence… plus I’ve tested it personally many times including just this afternoon when I hooked up some FETs to the imp’s pins 1,2,5 and 7. They don’t turn on until I configure the pins).
Which pin are you seeing this on, and what board are you using it with?
How about making a ‘low’ write(0) to make the relay turn on?
Example … relay ON: hardware.pin9.write(0);
relay OFF: hardware.pin9.write(1);
Tell us what kind of relays, and relay coil voltage.
You’ll basically be putting a resistor (like 1K-5K ohms) between the two relay control wires and hooking the imp pin to the negative (if polarized) or either the control wires. Both relay control wires will always be ‘high’ (relay off) until the imp pulls one of them ‘low’, the relay will turn on. If your relay needs more than 3.3V or draws a lot of current, you’ll have to use a transistor … but doing the same thing, let the transistor ‘sink’ the voltage on one of the transistor control wires.
I’m seeing +3.3v on all the GPIOs for about 2-3 seconds with everything disconnected (just a bare board). I’m using the SmartMaker.com break and shield. No change if I use external 5v or 3v direct connected. I have an email thread going with SmartMaker to see what they have to say about their board, it’s either got to be their board somehow or the imp itself that’s goofy. I don’t have any other boards or imps to cross test with yet unfortunately.
I have a workaround in place for this particular project since I only need 4 GPIOs (using a second transistor on an unused pin to pull the original pin down during bootup, after which just stays unused). But obviously something has to give since I expect this to work as designed.
Can you show us an actual schematic of what you have that isn’t working as expected?
How are you powering the board? With the micro-USB or another source to the pads? Can you show a pic of the board in your current setup?
Ahhh… the smarkmaker breakout has, I believe (looking at the photo) a FET based level shifter on all the IO lines.
This is a FET with pull-ups on both the imp side and the output side. This is where your highs are coming from, I would guess. To remove them from the circuit you’d need to break out the middle bit with the imp and power supply on it.
I have an email in to SmartMaker to see if they feel that this is normal behavior…
Based on the circuit I believe I can see there, yes it’s normal behavior. As I said, if you pull out the breakout part then you remove the level shifters from the circuit and it should behave just as I expect it to.
I can confirm that with the breakout board broken out it behaves normally. Thanks everybody!