# New to Spark Core

Hi All,

I am receiving my first core as a xmas present and got a sneak peak and I am absolutely surprised how small it is!

However I have a few questions mainly around the voltage logic, as I have programming skills but next to nothing in electronics except for some tinkering on an Arduino UNO.

• Since the Spark runs on 3.3V does this mean I wont need resistors on
LEDs or is the .3V still too much?

• If I have a sensor such as a RF Receiver or temp. monitor which runs
on 5V power, will the data line need to be reduced to 3.3V? I assume
in such scenario I can power the 5V through the VIN (using USB)

• When I do flash my own code onto the Core how do I get the Tinker
code back?

• Do I need to do any prep work before I use the Core, such as

Sorry for all the questions and I am sure there are more to come but I cant wait to be part of the community

Welcome to the awesome Spark Community!!!

The thing with LEDs is not actually the voltage but the current. Once your voltage exceeds the typical forward voltage, the diode opens and the current shoots up and you need to limit this current with a resistor. The only difference between 5V and 3.3V is that youâll need a smaller resistor to limit the current to e.g. 20mA. As you assumed a forward voltage of 3V for you LED youâd need 15 Ohm (0.3V / 0.02A), while vor 5V youâd need (5V-3V)/0.02A = 100 Ohm. But Iâd rather go for 2.5V forward drop and take a 33 or 47 Ohm resistor.

The best would be to use a level shifter (chip or home made with transistors or use the Spark Shield Shield), but you could get away with using some of the 5V tolerant Core pins (only 7 of 18 see docs) and hope that 3.3V is considered HIGH by the sensor.

To get Tinker back, you could use the inbuilt function of the Tinker Apps (iOS & Android), or do a factory reset, or just flash the source via the Web IDE, âŚ

Since I understood that youâve just recently ordered your Core it should already have the latest CC3000 firmware on it, so out the box and GO! GO! GO!

Hope this helped

As far as the sensor voltage goes: depending on how much current you require (<200mA), you can power it from the V_in. As far as I know, most input pins are 5V tolerable, but be sure to check the docs for that (hardware section - I/O)

You can get Tinker back by performing a factory reset, clicking the âinstall Tinkerâ from the app, of flash the code from the IDE (look for it in the docs under âTinkerâ I believe)

With the current Cores, the patches are already applied, so just unpack it and play

Thanks for the input guys, I am really eager to get my hands dirty but I must wait until the 25th and even then wait until the celebrations are over

I did order the Shield Shield as I thought that would be a safe route for my tinkering, however due to its size it would be nice to try to avoid using it

Really do need to get up to speed on all the electronic terminology and calculations , however I am glad to hear that some of the pins are 5V tolerable so hopefully should be ok

Another question I have is can I use the analog pins for digital use? eg. DigitalRead(A0); I assume I could always do a programming method and use the AnalogWrite(A0, 0) or AnalogWrite(A0, 1023) to do LOW and HIGH, then using a 50% calculation on the Read operation to determine if its LOW or HIGH?

PS. I think it might be useful if its not already around, a âArduino 101 Migration FAQâ to help answer these probably common questions, as I assume most would be coming from the Arduino starter kits

You can do a digitalRead or digitalWrite on the Ax pins; take a look at the pinout diagram ( http://docs.spark.io/assets/images/spark-pinout.png ) for exactly what each pin can do.

There are numerous options for logic level shifting, depending on exactly what you want. If youâre like me and canât be bothered making something from discrete components, you could try something like these bi-directional shifters: http://www.adafruit.com/product/395. If you donât need them bi-directional, there are cheaper options like the CD40109B (the datasheetâs not the best, but Iâm using them quite happily).

Edit: Actually, itâs probably worth reading all of this section of the docs: http://docs.spark.io/hardware/#spark-core-datasheet-pins-and-i-o

Just to be exact

The max value you can `analogWrite` is 255, but as @Nye said, you can `digitalWrite()` and `digitalRead()` on A-pins just the same - in fact the implementation of `analogWrite()` does actually do a `digitalWrite()` internally when you send 0 or 255.
As a little perk, you can even `digitalWrite()`/`digitalRead()` the RX and TX pins, too. So you do actually have 18 IO pins to your disposition
On the other hand if you do `analogRead()` your maximum reading on the Core will be `4095` since itâs a 12bit ADC compared to a 10bit ADC (max 1023) on a standard Arduino.

@ScruffR thanks for the detailed information if I want to address the analog ports do I still just use A0 or would I use D10?

@nye thanks for the logic level shifting link, that adafruit board looks great!

You just write `A0`âŚ`A7`.
Actually these âpin namesâ are defined as

``````#define D0 0
#define D1 1
...
#define A0 10
#define A1 11
...
#define A7 17
#define TX 18
#define RX 19
``````

And these numbers are used in a similar way as the pin numbers on Arduino.
But there would not be a definition for `D10`

1 Like