Learning Library

← Back to Library

USB‑C Raspberry Pi to Tablet Setup

Key Points

  • The author demonstrates how a USB‑C cable can simultaneously provide Ethernet networking and power from an iPad Pro (or any USB‑C iPad) to a Raspberry Pi 4, creating a portable Linux workstation.
  • To also keep the iPad charged, two options are shown: using an Apple Magic Keyboard for an extra USB‑C port (a clean but pricey solution) or a budget‑friendly USB‑C hub that supplies power to both devices.
  • The video expands the basic setup to support Lightning‑based iPhones/older iPads, Android USB‑tethering, and even older Pi models (e.g., Pi 3) by adding appropriate adapters and power‑management tricks.
  • As a universal fallback, a pure Ethernet‑over‑USB or wired Ethernet configuration is covered for situations where USB‑C or Lightning connections aren’t viable, ensuring compatibility with a wide range of single‑board computers.

Full Transcript

# USB‑C Raspberry Pi to Tablet Setup **Source:** [https://www.youtube.com/watch?v=cD3JN8BHosI](https://www.youtube.com/watch?v=cD3JN8BHosI) **Duration:** 00:13:29 ## Summary - The author demonstrates how a USB‑C cable can simultaneously provide Ethernet networking and power from an iPad Pro (or any USB‑C iPad) to a Raspberry Pi 4, creating a portable Linux workstation. - To also keep the iPad charged, two options are shown: using an Apple Magic Keyboard for an extra USB‑C port (a clean but pricey solution) or a budget‑friendly USB‑C hub that supplies power to both devices. - The video expands the basic setup to support Lightning‑based iPhones/older iPads, Android USB‑tethering, and even older Pi models (e.g., Pi 3) by adding appropriate adapters and power‑management tricks. - As a universal fallback, a pure Ethernet‑over‑USB or wired Ethernet configuration is covered for situations where USB‑C or Lightning connections aren’t viable, ensuring compatibility with a wide range of single‑board computers. ## Sections - [00:00:00](https://www.youtube.com/watch?v=cD3JN8BHosI&t=0s) **Pi‑Tablet USB‑C Connection Guide** - The video walks through various methods for linking a Raspberry Pi (Pi 4 and older models) to iPads, iPhones, and Android devices via USB‑C, Lightning, and USB tethering, covering power delivery, networking, and setup options. ## Full Transcript
0:00in today's video i'll walk you through a 0:01bunch of different setups for connecting 0:03your raspberry pi with your tablet or 0:05your smartphone i've been using my ipad 0:07pro together with the raspberry pi 4 as 0:09a mobile computing setup for around 0:11about two years now in my setup the pi 0:14and ipad are connected using a single 0:16usb-c cable allowing them to talk to 0:19each other and providing the pi with 0:21power from the ipad if you'd like to see 0:23more about that setup and what i use it 0:25for i have a video going into detail on 0:27that here 0:28now this is a great setup for ios users 0:30in particular because it allows you to 0:32carry a fully fledged linux setup with 0:35you alleviating the need to rely on 0:37connectivity back to your home office or 0:39to the cloud 0:41if you already have a tablet i also 0:42think this is a great way to start 0:44learning about linux and about the 0:46raspberry pi without having to invest in 0:48a ton of new hardware we're going to 0:50look at a bunch of different 0:51configurations in today's videos and 0:52i've put timestamps in the description 0:55for each of these sections we'll start 0:57with a simple one cable setup for the pi 0:594 that works with usbc ipads and we'll 1:02expand that solution adding various 1:04options for powering those two devices 1:06we'll expand even further to look at 1:08lightning based devices like the iphone 1:10and older ipads and then we'll go a step 1:12further to look at a really nice usb 1:14tethering solution that works on android 1:16that works on some ios devices and that 1:19supports older pies like the pi 3. and 1:21then finally we'll look at a pure 1:23ethernet based solution that is a great 1:25fallback for other single board 1:27computers when none of these setups will 1:30work for you and your devices let's get 1:31started with the simplest possible wired 1:33setup a single usbc cable connecting a 1:36usbc ipad and the raspberry pi 4. i'm 1:40using the gen 5 ipad air here but as of 1:42the time of filming this setup works 1:44with any of the usb-c capable ipads 1:46connectivity between the ipad and the pi 1:48is ethernet over the usbc cable and 1:51power is also delivered from the ipad 1:54to the pi on that same usbc cable 1:58and this is where the first limitation 2:00of this setup arises there's no way to 2:02power the ipad at the same time as 2:05powering the pi 2:06one way of addressing this is to 2:08introduce the apple magic keyboard 2:10with the magic keyboard in the mix you 2:12get an extra usbc port for powering the 2:14ipad and the pi at the same time and you 2:17can still use the ipad's primary port 2:19for connectivity between the two devices 2:22now this is the setup that i use and i 2:24do think it's the cleanest setup but it 2:26is expensive the price of the magic 2:28keyboard always discomforts me and if i 2:30didn't use it so often 2:32i would absolutely look for a cheaper 2:34option for this setup the best of which 2:36is to use a usbc hub pretty much any 2:39usbc hub that accepts power input will 2:41do here i bought this anchor seven in 2:44one hub with my own money not sponsored 2:46which has usbc power in and a usbc data 2:49port the hub gets plugged into the ipad 2:52power gets plugged into the hub and then 2:54the pi is plugged into the hub's usbc 2:56data port 2:58if you're working with a setup like this 3:00and you're having issues make sure that 3:02you're plugging the hub's captive cable 3:04into the ipad and not into the pi 3:07usbc hubs or usb hubs are directional 3:10and one port is designated for the host 3:13with the rest being for downstream 3:14peripherals or power input 3:16if your usbc hub doesn't have a captive 3:18cable it will likely have a port 3:20explicitly labeled for the host this is 3:23a nice setup to avoid having to buy a 3:24magic keyboard and you get the added 3:26benefits of all the ports on the hub if 3:28you already have a usbc hub but it's one 3:30without a usbc data port don't worry you 3:33can use a usba to usbc cable on your 3:36hub's usba ports to connect the pi 3:38without any problems at all it's worth 3:40taking a minute just to understand how 3:41this setup is working by default both 3:44the ipad and the raspberry pi want to be 3:47usb hosts that is that they want to have 3:49usb peripherals like hard drives and 3:51webcams plugged into them 3:53in this setup though the ipad remains as 3:56a usb host but the pi is configured to 3:58act as a usb peripheral specifically 4:01it's configured to act as a usb ethernet 4:03adapter 4:04this is enabled by a technology called 4:06usb otg or usb on the go the pi 4 only 4:10supports otg on each usb c port which is 4:13quite handy because we can then get 4:15connectivity and power through that 4:17single port as we'll see though all the 4:18single board computers like the 4:20raspberry pi 3 4:22don't support otg at all and will need a 4:25different solution you do need a little 4:26extra configuration in your os to enable 4:29otg on the pi 4. i'm not going to 4:31discuss that here because i have a bunch 4:32of videos and guides on my website 4:34discussing the various configuration 4:36options for the various different linux 4:37distributions and i've linked all those 4:39below as we've seen it's easy to connect 4:41a usbc ipad to the pi 4 and we have 4:44plenty of options for power but what 4:46about ipads with lightning ports what 4:48about the iphone 4:49although it's not possible to get by 4:51with just a lightning to usbc cable it 4:54is possible to connect the pi 4 and the 4:56lightning based ios device with just a 4:59few pieces of equipment first up you 5:00will need a lightning usb to otg adapter 5:04apple has a few first party options 5:06often referred to as being a camera kit 5:08or a camera adapter for example i have 5:11this official apple usb 3 camera adapter 5:14that works really well and i've also had 5:16some success with cheaper third-party 5:18adapters and i'll link a few in the 5:20description below lightning devices 5:22don't provide enough power for the pi 4 5:24so you'll also need a powered hub which 5:26can be either usb-a-hub or a usb-c hub 5:28start by connecting the otg adapter to 5:30your lightning device i'm using my 5:32iphone here next up plug your hub into 5:34the otg adapter remembering to power the 5:37hub from there connect the usbc port 5:40from the pi to the hub it's absolutely 5:43fine to use a usbc to usb a cable here 5:46if your hub only has usb ports 5:49if you're looking for a hub for this 5:50setup i picked up this cheap you green 5:52hub for testing purposes and it works 5:54just fine even if it does feel a little 5:56bit plasticky most of the lightning otg 5:59adapters i've seen take usb a input not 6:02usbc input 6:04so if you have a usbc hub with a captive 6:07host cable you'll need an adapter and i 6:09picked up this cheap adapter on amazon 6:11that has worked well for me so this 6:12setup is a little messy than the one for 6:14the usbc ios devices but it does work 6:17just as well and it's much cheaper than 6:19upgrading to a usbc ipad just to try 6:22this out i want to note at this point 6:24that the pi doesn't share the internet 6:26connection from the ios device in any of 6:28the setups that we've seen so far you'll 6:31need to connect the pi to wi-fi 6:32separately this can be the hotspot on 6:34your cell phone or on your cellular ipad 6:37if you have one but this does not happen 6:39automatically this video is brought to 6:41you by the techcraft patreon all patrons 6:42get access to the private techcraft 6:44discord exclusive behind the scenes 6:46content early access to every video and 6:48input on future videos patrons on the 6:50channel championship got access to a 6:52monthly video hangout and an exclusive 6:54monthly deep dive tutorial 6:56this month's tutorial is a step-by-step 6:58guide to automatically building your own 6:59raspberry pi images link to the patreon 7:02in the description below let's now turn 7:03our attention to android devices and i 7:05want to start with two disclaimers first 7:07up android devices are way more varied 7:10than ios devices so i can only provide 7:12broad guidance to what should work 7:15second i only have one android device 7:18myself and i've only had it a few months 7:20so it's possible there are other 7:21connection options here and if you know 7:23of any such options please do share them 7:25in the comments below i'm using a 7:26samsung galaxy tab sa ultra for my setup 7:29and this device powers the pi 4 just 7:31fine from the usb c port but i've had 7:34limited success 7:36getting the single cable usb otg setup 7:39to work my essay seems to get confused 7:42about which device is the host which is 7:44the peripheral 7:45i don't want to say that this 7:46definitively doesn't work um but i can't 7:49get it to work reliably 7:51that's okay though because there's 7:52another solution for android one that i 7:53think is particularly attractive 7:56in this solution we're going to flip the 7:57usb rolls around we'll make the pi the 8:00host and have the android device be the 8:02peripheral to do this you'll want to run 8:04your pi with the stock os configuration 8:07and not with the otg peripheral 8:09configuration needed by the previous 8:11setups power up the pi and then connect 8:13any of the usb a ports not the usb c 8:16port this time to your android device 8:19the sa ultra has a usbc port so i'm 8:21going to use a usba to usb c connector 8:24then in your android device enable usb 8:26tethering 8:27after a second or two your android will 8:29configure itself to act as a virtual 8:31ethernet adapter and you're free to 8:33connect to the pi 8:34however 8:35you don't yet know the ip address of the 8:37pi and you can't use the pi's host name 8:40because most android systems don't 8:42support zero comp networking out of the 8:44box 8:45not to worry though we can solve this 8:46using the excellent termix app 8:49in turmoix which you will probably need 8:51to install using f droid these days 8:53install the nmap package with pkg 8:56install nmap 8:57and then let's do a port scan like we're 8:59in mr robot 9:00to find out what to scan let's first 9:02find out the address of the android 9:04device itself using the ifconfig command 9:07and for my usb 0 interface you can see 9:09that i have an address starting with 192 9:12168 175 9:15so 9:15i'll run nmap with dash p22 to scan port 9:2022 9:21dash dash open to look for open ports 9:24and then 192.168.175.0.24 9:30to scan all of the addresses between 9:33192.168.1.751 9:35and one nine two one six eight one seven 9:37five two five five so basically try to 9:39find what address has been assigned to 9:41the pi after a few seconds you'll see 9:43the results complete with the ip address 9:44of your pi and then you're free to log 9:46in over ssh 9:48now the best part of this setup is that 9:50the pi can share the internet connection 9:52from the android device so if we disable 9:55the wi-fi connection on the pi we can 9:57use sudo ifconfig wlan zero down to 10:01disable wlan zero adapter we can still 10:03access the internet from the pi 10:06another benefit of using usb tethering 10:08this way is that it also works on the pi 10:103 and probably works on older pies too i 10:13just don't have any working devices that 10:15i can test on 10:16this setup may even work well on non-pi 10:19single board computers the only downside 10:22of this setup is that the pi is now 10:24powering the android device over its 10:25basic usb a port and for a tablet like 10:28the sa ultra this is just simply not 10:30enough power and i found that my s8 10:33seems to slowly discharge over time in 10:35this setup but you can always experiment 10:37with putting a powered hub in line if 10:39you want to get more power 10:41although i will say i've had mixed 10:43results with this setup the same usb 10:45tethering solution that works so well on 10:47android also works on the iphone and on 10:50cellular ipads 10:51sadly there's no usb tethering support 10:53on wi-fi only ipads 10:55i've no idea why 10:57only three steps are needed firstly you 10:59need to install the usb mux-d package on 11:01your raspberry pi which you can do with 11:03sudo apt-install usb mux-d on the 11:06standard raspberry pi os 11:08next connect the usb-a port on your 11:10raspberry pi to your ios device and this 11:13time you can use a standard usb to 11:16lightning cable you don't need any 11:17special otg adapters here when you 11:20connect you'll be prompted to trust the 11:21device so click yes to trust and then 11:23finally in ios settings 11:25make sure that you enable your personal 11:27hotspot 11:29now you're free to connect to the pi 11:31from your ios device and as with the 11:33android setup we can disable the wi-fi 11:35on the pi and share the cellular 11:37connection from the ipad or the iphone i 11:39think that the tethering solution is the 11:41best approach for older pies and also 11:43the best approach for cell phones since 11:46the pi can satisfy their power draw and 11:48can share the internet connection 11:50obviously for tablets you won't be able 11:52to satisfy the power draw so you might 11:54want to look to the solutions at the 11:56start of the video 11:57if none of the solutions so far fit your 11:59phone fit your tablet fit your single 12:01board computer then you can likely fall 12:03back on using a standard ethernet cable 12:05to connect the devices for this setup 12:07you'll need some kind of usb ethernet 12:09adapter for your tablet or your 12:10smartphone this can be a dedicated 12:12adapter it can be a usb hub with a 12:14dedicated adapter or it can be a usb hub 12:16that has ethernet built in already 12:18so for example i've got my ipad air here 12:21and i've connected my wife's usb c hub 12:23which is a three or four year old 12:25hyperdrive model that does happen to 12:27have an ethernet port built in 12:29i can connect this port to the ethernet 12:31on my pi using a standard ethernet cable 12:33here and then power the pi using a usb 12:36cable from one of the hub's usb ports 12:38straight out of the box with stock 12:40raspberry pi os the pi is accessible 12:42over ssh there's no changes needed so 12:44you don't need the otg configuration 12:46here 12:47there's nothing special about this setup 12:49there's nothing specific to the pi so it 12:51works with the pi 4 as well and it 12:53should also work with pretty much any 12:55single computer that runs linux and has 12:57an ethernet adapter 12:59you may need some configuration though 13:01to get things like hostname resolution 13:03working in summary then we've seen a 13:04bunch of different solutions for 13:06connecting tablets and smartphones with 13:08single board computers like the 13:09raspberry pi i'm sure at least one of 13:12the solutions shown in this video will 13:13work for you and for your devices and i 13:15hope that you enjoyed trying them out i 13:17also hope that you found this video 13:18useful and maybe even a little 13:20entertaining if so please hit like 13:21please hit subscribe and maybe hit the 13:23bell as well so you don't miss out on 13:24any future content thanks so much for 13:26watching and i'll see you in the next 13:27video