Safely establishing a connection between Pokitto and an Arduino Uno

I haven’t done anything programmy in a while, so I thought I’d try to get my Pokitto talking to my Arduino Uno.

Howver, I know the Uno runs on 5V and the Pokitto can only handle 3.3V, so what would be the best way to conenct the two without risk of damage?

Also what are my options for connecting the two?
I2C, SPI?

#Good News!

It was recently pointed out to me (doh!) that almost all LPC11U68 pins, are in fact, 5V tolerant!

Talk about not having read the small print in the manual… :blush:

@pharap: page 562 onwards, look for pins remarked with [3], [6] and [8]

2 Likes

I have also used a similar setup as below to drive 5V neopixels from pokitto

EDIT:

Signal from 3V3 (Pokitto) to 5V Arduino

Use schematic shown above. 2 normal diodes and 1 10k resistor needed.

  • 3V_OUTPUT can be any I/O pin outputting from the Pokitto header
  • +3V3 is Pokitto 3V3 power pin from PEX header
  • +5V is Arduino 5V pin
  • 5V_INPUT is the input pin on Arduino
  • REMEMBER TO PUT DIODES the RIGHT WAY AROUND (google it)

What this arrangement does is it shifts the 0…3.3V signal to 0.7V…4.0V which is within the LOW/HIGH treshholds of the Arduino 5V logic. Easy to build, works flawlessly.

Signal from Arduino (5V) to Pokitto (3V3)

Maybe nothing needed. Just connect directly from Arduino to a 5V tolerant pin on Pokitto (see diagram by @Pharap below)

If you want to play it safe, use lower schematic in the above picture.

  • 1 diode needed, 1 x 10KOhm resistor
  • 5V_OUTPUT is signal from Arduino
  • 3V_INPUT is input pin on Pokitto

I2C Arduino<->Pokitto

I HAVE NOT TESTED YET!

3 Likes

Excellent, that will make this marginally easier.

Perhaps we should highlight which PEX pins are and aren’t 5V tolerant on the canonical PEX diagram:

https://talk.pokitto.com/uploads/default/original/2X/9/95871dbaa565af8909bf47ea5c7efaa44aac610a.png

Those are the 5V tolerant pins if I’m reading this correctly.


I’m adding ‘revise circuit diagrams’ to my ‘todo’ list.
I recognise the resistor at least.

I am adding a little bit more explanation above to help you get started

1 Like

you could run a breadboard uno off the pokitto 3.3v i think

1 Like

I’d say go with I2C - the way I2C works is that both devices can only drive the lines low, not high. Instead, there are two pull-up resistors that pull the lines high when they are released (common resistor value to use is 4.7K, but you can do the math if so inclined).

So, in this case you would have the pull-ups tied to 3.3V - I checked the ATmega328P datasheet and the good news is that minimum that is recognised as an ‘Input High Voltage’ when VCC = 2.4V to 5.5V, is 0.6 * VCC (so, 0.6 * 5V = 3V which still leaves you 0.3V for good measure!).

Yes, there is 5V tolerance available on the Pokitto, but that is 5V Maximum, 5.5V Absolute Maximum! Probably not healthy in the long run, and the topic does say ‘safely’! :smile:

So, all you need are a couple of external pull-up resistors and a few jumper leads to get started…

1 Like

The easiest, but perhaps not the fastest, may be to use the UART.

PEX EXT 6 - UART0 RXD to UNO Pin 1 - TXD
PEX EXT 7 - UART0 TXD to UNO Pin 0 - RXD
PEX GND to UNO GND

Use the standard Serial library on the UNO. I’m sure there’s something similar for the Pokitto.

(You still have to consider 5V - 3.3V issues.)

2 Likes

Additionally, on 5V tolerance - from the datasheet: “5 V tolerant I/O pins; only valid when the VDD(IO) supply voltage is present” and “When configured as analog input, digital section of the pad is disabled and the pin is not 5 V tolerant”.

EDIT: Good news is that I2C as I suggested above should be fine, as those two pins are the exception to the rule: “Applies to all 5 V tolerant I/O pins except true open-drain I2C-bus pins PIO0__4 and PIO0__5, 5.5 V can be applied to these pins when VDD(IO) is powered down, compliant with the I2C-bus standard”.

1 Like

A standard popular level converter module is an option

https://www.ebay.com/sch/i.html?_nkw=IIC+I2C+Logic+Level+Converter+Bi-Directional+Module

1 Like

Welcome back @uXe and @MLXXXp !

Yep, 5.5v may be cutting it close.

I’ll try to get some “torture tests” done.

BTW I have tried shorting the PEX pins into output pins, constant short, temporary. So far I have not been able to “kill” the device with its own voltage, no matter how I short them. Edit: I think one of you warned against shorting vdd to a low output pin. As far as I have tried, it has no effect.

1 Like

Note that both SPI and I2C are really only meant for component to component, on the same board, or board to board over short distances. The same would be true for direct pin to pin UART connections.

If the goal is to connect over longer distances, you could consider using a pair of TTL to RS232 converter modules with the UARTs.

3 Likes

My reply is a bit delayed because I was making this:

  • Green is 5V tolerant.
  • Yellow is 5V tolerant unless it’s being used as an analogue input.
  • Red is not 5V tolerant.
  • Grey is ‘not applicable’
    • GND should be fine with 5V right? The point of ground is to drain the power (or something like that)?
  • Cyan is “I don’t know, there was no P to match to the data sheet”
    • I suspect 3v3 should be grey since it’s an output

I’ll wait for someone else to double-check that before I go adding it to the PEX page.

Anode (+) long, cathode (-) short.

I’m not sure if I’ve got a plain old signal diode in my box of tricks, I’ll have to check.

Those bullet points are very useful, thanks.

According to the data sheet, some aren’t when they’re cofigured as analogue inputs (category [3] and category [4]).
I won’t be doing that anyway, but it’s something to be wary of.


Do you mean remove the chip?


@uXe that sounds promising, but I think I’d understand it better with a diagram.

Or at least with an idea of which pull up resistors I’m configuring to what value.
I can locate the Pokitto’s I2C ports and I’ll look the Uno’s up later, but I don’t know which resistors I’m hooking up to what.

I spotted that. The reason I took so long to start replying was because I was checking every pin and its caveats.

Whereabouts is that?
When I looked at the table both the I2C pins were marked as cat [7], which is:

I2C-bus pin compliant with the I2C-bus specification for I2C standard mode, I2C Fast-mode, and I2C Fast-mode Plus. The pin requires an external pull-up to provide output functionality. When power is switched off, this pin is floating and does not disturb the I2C lines.
Open-drain configuration applies to all functions on this pin.


Why do the grounds have to be linked?

Overall that does seem easiest. I’m not worried about speed yet.

There is, and there’s a tutorial for it here.

This is one of my bigger concerns.
I’ve never attempted to hook a 3.3V board up to a 5V board and I don’t want to get it wrong in case I damage the Pokitto.

A good idea if I end up wanting to do this a lot.
For the time being I’d rather attempt to do it using parts I already have though.

Distance is not an issue and probably won’t be an issue.
For the moment I’m just attempting a proof of concept experiment.


@jonne, @adekto, @uXe and @MLXXXp - thank you all for your input.

1 Like

basicly, the uno board power is build around 5v but the chip can run lower
example of uno on 3.3v

would not break an uno board, just put the chip and crystal on a breadboard

Page 44/45 of the datasheet, footnotes [3] and [5].

Popped up on Google Image search:

(resistors are 2.2K here, but you get the idea) :wink:

1 Like

(The ground is often used as a reference of 0V. If you connect the local 5V to the local 0V, you’re essentially shortcutting the power source. When communicating with a system powered by another source, you need a reference voltage somewhere - usually GND is that reference voltage, but sometimes you get 5V or 3.3V voltage like I2C does)

You still need to connect grounds for two separate devices that communicate using I2C.

1 Like

It’s a little bit haphazard but I managed to get both the 3V to 5V transition and the 5V to 3V transition working.

I don’t think it’s going to be enough for what I want to do unless I’m prepared to invent a new communication protocol.


Here’s my code:

And here’s some photos of the setup:


I presume that it was a success since nothing exploded and the programs ran as expected.

I’m definitely going to need I2C or UART to achieve what I want to though.


@MLXXXp, would it be possible to use USB-serial at the same time as serial over the TX(1) amd RX(0) pins?

2 Likes

Oh, sorry, I thought it’d directly work that way, thanks for the correction!