iPhone serial to Arduino

I have a PodBreakout board so I can interface my Arduino and iPhone. The pinout sheet for the iPhone says that the TX and RX are both 3V. Can I plug the wires directly into digital pins 0 and 1, or would I need (some (combination of)) resistors/capacitors to keep both safe?

Thanks! :slight_smile:

Hi

Ideally you'd use a logic level converter to make sure the 3V tollerant bits at the more expensive iPhone end are kept safe. There are heaps of different breakout boards for this, or if you're looking for a component only the 74HC4050 and similar buffers are also easy to come by and just as simple to use.

These translate the voltage at both sides.

Cheers !
Geoff

Thanks for the input!

As far as I can tell, the 74HC4050 could only be used one way, correct? And high-to-low? What about if I went to send from the Arduino to the iPhone?

The breakouts like this one from Sparkfun are cheap and easy to use, and bidirectional.

Cheers - Geoff

Perfect! Ordered one of those. :slight_smile: I got the PodBreakout in the mail a few days ago (still setting up OS X on my laptop so I can actually make iPhone apps to communicate with the Arduino...) and just realized today that I might need something like this. Thanks a lot!

So that breakout board should be arriving in the mail tomorrow. Are there any resistors I need, or can I just use this logic level converter?

I've been reading online that some people have used a voltage divider (with a 20k and 39k resistor, or 10 and 15 if you don't have those), and I also say someone said they used a 1k resistor between the Arduino TX and iPhone RX. I'm not sure if I need either or both of those with the logic level converter or not.

Thanks again if anyone can help. :slight_smile:

Most logic converters have the dividers inside, or maybe not, but it all depends on the converter. The sparkfun one seems like its a newer one with the divider built in, so it should work. However, you might just want to do a test run with a voltmeter and a couple of batteries. However, is the iPhone 3.0v or is it 3.3? This converter uses 3.3, and that third of a volt can be dangerous. Make sure of that before you go, maybe thats the reason for the resistors.

Well, according to the pinout sheet that came with my PodBreakout, the RX and TX pins are 3v, while the power out (pin 18) is 3.3v. So yeah, I'd assume the sheet is correct and that I should use a resistor. If this converter has a divider in it, will I just need a 1k resistor, or something else?

And it shouldn't matter on which side of the converter I put the resistor, right? I mean, as far as I know the converter is linear and not logarithmic. So if I fed it 4.7v it would come out 3v if I'm not mistaken.

Apart from knowing the iPhone's serial pins are 3v, I don't know the amperage , so I'm not sure if a 1k ohm resistor would work here or not.

How do you will communicate to the Iphone using TX and RX Pins?
Apple does not allow that as far as I know.

There's a program called Minicom that let's you use console commands to write to the Arduino. There's also something called openframework that lets you write to serial easily. You can also do it manually.

You can read about it some here:
https://docs.google.com/document/d/1Yi9_hcw8XSyYNCG2OJT9oHlTG-dC-Dnuc58VIULa81Q/edit

Success! Kind of, for half of it.

I'm able to receive data, but only under certain situations. If I use "cat /dev/tty.iap 9600" in SSH and then turn on my Arduino, I just get a bunch of question marks. But if I use "cat /dev/tty.iap 9600" after the Arduino sketch has already started, I get the expected result.

Does anyone know a way around this? Or even why it's happening? If anything, I'd think it wouldn't work using the "cat" command after the sketch started, but would before, so it seems counterintuitive to me. It's not really a big deal, since in most if not all cases the sketch would be running before the iPhone does anything, but I don't even understand why this is the case.

Both "cat /dev/tty.iap 9600" and minicom work fine for me. Although minicom only works on my Mac from SSH. Windows SSH (with the terminal built into WinSCP anyway, which is probably the cause) doesn't work, complaining about no "cursor movement capability". On the iPhone itself in the Terminal app from Cydia, I'm not sure how to use the setup screen since you need arrow keys to navigate it. In the options for Terminal you can set gestures to arrows, but for some reason that just exits the program before I can change anything. If anyone can find a way around that, great, but if not, you can always use SSH to create a config file (port is /dev/tty.iap, baud rate is 9600, and turn off hardware and software flow control), then safe it, then load minicom from Terminal, logging in as root first (do "su -l root", password is alpine), then it should work. :slight_smile:

As for sending data to the Arduino, I haven't tested anything yet. I don't see why I couldn't do it though.

Also, the logic level converter is completely useless in this circuit... The Arduino digital pins only appear to put out 2v, not 5, so you don't need to do anything with voltage. Just a single 1k ohm resistor between the Arduino's TX and iPhone's RX and you're set.

HugoPT:
How do you will communicate to the Iphone using TX and RX Pins?
Apple does not allow that as far as I know.

With Jailbrake only
Hope that after the Steve death this kind of things will change

sjheiss:
Also, the logic level converter is completely useless in this circuit... The Arduino digital pins only appear to put out 2v, not 5, so you don't need to do anything with voltage. Just a single 1k ohm resistor between the Arduino's TX and iPhone's RX and you're set.

Which Arduino do you use? I had presumed a Uno (ie 5V logic) but I notice you didn't specify, so my bad.

Yes I have an Uno, but I used a multimeter to check, and the TX pin only puts out 2 volts. So unless either the multimeter or my understanding is faulty, then I wouldn't need one.

As for sending and receiving data correctly, I just realized I could implement a handshake to solve that problem. :stuck_out_tongue:

A Uno is 5V with a digital pin held high. I'm presuming either a new battery needed in your multimeter, or your pin was transmitting a stream of 1's and 0's so it appeared 2V to the multimeter.

yes,
multimeter do not have the necessary speed for this measure, so you measure an average.
If you use a scope you will see 0-5V

Oh. Well, the logic level converter I got doesn't appear to have metal contacts, so I'm not sure how I'm supposed to solder it...

I can always use a regular voltage divider though.

How could it not have? I'm looking at a BOB08745 right now and it has rows of drills on each side which are tinned for soldering

Well the one I have has holes, but they are surrounded by white plastic, not metal. Last I checked, tin is shiny, not matte white like plastic.

Anyway, how do I build a voltage divider? I have a 10k and 15k as I've found online to work, but I've tried 3 different schematics for a voltage divider, and it never divides the voltage, even though the data goes through... I also need a 1kohm resistor between the voltage divider output and the input of the iPhone's pin.

volt, not ampere