I’m finding this pretty confusing. I get that if the device outputs 5v and the spark only wants 3.3, then its overloaded, but what about the other way around? If This is controlling a motor and I write HIGH to the enable/control pin, it will write 3.3v instead of 5v. Does that mean the motor will only move at 66% speed?
No, this won’t cause the motor to run slowly. The motor speed is normally controlled by the mark/space ratio of the pwm signal you feed it. If you just feed it a high=5V signal the motor will run at full speed. With a 3.3V signal, there’s a good chance it will work fine, but no guarantees. It will probably either run at full speed or not at all. Many 5V chips will read 3.3V as a high signal even though their data sheets don’t specify that they will. I would go ahead and purchase anyway, at that price. If it won’t respond to a 3.3V signal, probably a couple of transistors will need to be added to boost the 3.3V up to 5V.
You mentioned that 5V would overload the Spark Core’s inputs. Actually, according to Zach, the digital inputs are 5V tolerant. The analog inputs, however, are not.
Where is this mentioned? I think this is important and should be displayed prominently. Also I have been looking at these logic level converters to use with a 5v relay board : 4 channel 8 channel
For now I am using a MOSFET to trigger the relay board.
The Spark Core offers a total 18 I/O pins to the user: D0 to D7, A0 to A7 and two pins that are preset to serial - TX and RX. All of these I/O pins run at 3.3V and the user should keep this in mind before attaching any external peripherals to them. The only exception to this are the following pins that are tolerant to 5V inputs:
I doubt you need anything as fancy as those level converters to drive a relay board. Your mosfet should be fine, but better make sure there are protection diodes on the relay board, if not, add them to your circuit. Good old ULN2803 can drive 8 small relays no problem and has protection diodes built-in.
Sorry for any confusion; the definitive guide for pin capabilities (peripherals, voltage tolerances, etc.) is in the pin-mapping spreadsheet in the Spark Core repository:
D2 is in fact not 5V tolerant, but all the rest of the digital pins are.
Hi guys,
Thanks for the replies. I also noticed that a digital read on the pins that I am using to trigger the relays, results in a digital LOW. Is there a way around this?