Close
0%
0%

IO PCB for Raspberry Pi

How to make IO PCB for Raspberry Pi

Similar projects worth following
The goal of this project is to provide an open source design for a Compute Module based board, that anyone will be able to use as a starting point for designing their own custom board. The board was designed on KiCAD, an open source and cross platform EDA software package, in order to allow as many people as possible to take advantage of it.

If you’ve never heard of the Raspberry Pi Compute Module before, it’s basically a fully fledged Linux computer with the form factor a laptop RAM stick!

With it becomes possible to design your own custom boards where the Raspberry Pi is just another component. That gives you an enormous amount of flexibility as it allows you to have access to a much greater amount of IO pins, while the same time you get to choose exactly what hardware you want on your board. The on-board eMMC also eliminates the need for an external micro SD card, which makes the Compute Module perfect for designing Raspberry Pi based products.

Unfortunately, while the Compute Module allows you to do all this it still appears to be lacking in terms of popularity compared to the traditional Raspberry Pi Model A and B. As a result, there aren’t many open source hardware projects out there based on it. And for anyone who might want to get started with designing their own boards the amount of resources they have is rather limited.

When I first got started with the Raspberry Pi Compute Module a few months ago, that was exactly the issue I was faced with. So, I decided to do something about it. I decided to design an open source PCB based on the Compute Module, that is going to have all the basic features that make the Raspberry Pi great. That includes a camera connector, USB host, audio output, HDMI and of course a GPIO header compatible with the regular Raspberry Pi boards.

The goal of this project is to provide an open source design for a Compute Module based board, that anyone will be able to use as a starting point for designing their own custom board. The board was designed on KiCAD, an open source and cross platform EDA software package, in order to allow as many people as possible to take advantage of it.

Simply grab the design files, adapt them to your needs and spin your own custom board for your project.

  • 1 × Raspberry Pi Compute Module 3 I highly recommend getting the regular version which includes the on-board eMMC and not the Lite version. If you want to use the Lite version in your project you’ll have to make a few changes to the design, and that includes adding a micro SD card connector. Finally, I have only tested the board with the CM3 and I cannot guarantee that it will work with the first CM version that was released back in 2014.
  • 1 × Compute Module IO Board My design was intended to serve as a starting point for designing your own custom board based on it, not to be replacement for the Compute Module IO board. So, to make your life easier I highly recommend getting your hands to an IO board and use that for development before moving to a custom board. Apart from giving you access to every single pin of the CM plus a variety of connectors, the IO board is also needed for flashing the on-board eMMC. Which is something that you cannot do with my board, unless you do some changes to the design first.
  • 1 × Raspberry Pi Zero Camera Cable or Compute Module Camera Adapter On my design I’m using a very similar camera connector to the one used by the Compute Module IO Board and the Raspberry Pi Zero. So, in order to attach a camera you're either going to need an adapter cable designed for the Pi Zero or the camera adapter board that comes together with the Compute Module Development Kit. As far as I know, purchasing the adapter board separately is quite expensive. So, if you like me decided to buy your CM and IO Board separately to save some money, I advise you to get the camera adapter cable designed for the Pi Zero instead.
  • 1 × Raspberry Pi Camera Module I have only tested the board with the original 5MP camera module and not the newer 8MP version. But since the former appears to be working just fine I see no reason the later wouldn’t as it is supposed to be backwards compatible. Either way, the 5MP version can be found for less than 5€ on eBay nowadays which is why I’d recommend getting one.
  • 4 × Female to Female Jumper Wires You are going to need at least 4 for configuring the camera connector on the IO board, you’ll likely want to get more though. They aren’t needed for the custom board but can be useful if you plan attaching any external hardware via the GPIO header.

View all 10 components

  • 1
    Flashing the EMMC

    First thing you need to do before you start using your Compute Module is flashing the latest Raspbian Lite image on the eMMC. The official Raspberry Pi documentation is very well written and describes the whole process in great detail for both Linux and Windows. For that reason I’m only going to describe the steps you need to take very briefly on Linux, so they can serve as a quick reference.

    First of all, you need to make sure that you have your IO board set to programming mode and the Compute Module is inserted to the SODIMM connector. To set the board to programming mode move the J4 jumper to the EN position.

    Next, you are going to need to build the rpiboot tool on your system so you can use it to obtain access to the eMMC. To do so, you need a copy of the usbboot repository which can be obtained easily using git as follows,

    git clone --depth=1 https://github.com/raspberrypi/usbboot && cd usbboot

    Now, in order to build rpiboot you need to make sure that both libusb-1.0-0-dev and make packages are installed on your system. So, assuming you’re on a Debian based distro such as Ubuntu run,

    sudo apt update && sudo apt install libusb-1.0-0-dev make

    If you don't use a Debian based distro the name of the libusb-1.0.0-dev package might be different, so make sure to find how it is called in your case. Once the build dependencies are installed you can build the rpiboot binary simply by running,

    make

    After the built is complete run rpiboot as root and it will start to wait for a connection,

    sudo ./rpiboot

    Now plug the IO board to your computer by connecting a micro USB cable to its USB SLAVE port and then apply power to the POWER IN port. After a few seconds the rpiboot should be able to detect the Compute Module and allow you access to the eMMC. That should result to a new block device appearing under /dev. You can use the fdisk program to help you find the name of the device,

    sudo fdisk -l
    Disk /dev/sdi: 3.7 GiB, 3909091328 bytes, 7634944 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x8e3a9721</p><p>Device     Boot  Start     End Sectors  Size Id Type
    /dev/sdi1         8192  137215  129024   63M  c W95 FAT32 (LBA)
    /dev/sdi2       137216 7634943 7497728  3.6G 83 Linux

    In my case it was /dev/sdi as I have quite a few drives already attached on my system, but yours will most definitely vary.

    After you’ve been absolutely sure you have found the correct device name, you can use dd in order to burn the Raspbian Lite image to the eMMC. Before doing that though, make sure that there aren’t any partition of the eMMC already mounted on your system.

    df -h

    If you find any unmount them as follows,

    sudo umount /dev/sdXY

    Now be extremely careful, using the wrong device name with dd can potentially destroy your system and cause data loss. Do not proceed with the next step unless you’re completely sure that you know what you’re doing. If you need any more information please have a look at the documentation regarding this.

    sudo dd if=<date>-raspbian-stretch-lite.img of=/dev/sdX bs=4M && sync

    Once the dd and sync commands finish, you should be able to unplug the IO board from your computer. Finally, don’t forget to move the J4 jumper back to the DIS position and your Compute Module should be ready for its first boot.

  • 2
    First Boot

    Before booting for the first time make sure to plug a USB keyboard and an HDMI monitor to your IO board. If everything goes as expected and your Pi finishes booting, having them attached will allow you to interact with it.

    When you’re prompted to login use "pi" for the username and "raspberry" for the password as these are the default login credentials. You can now run some commands to make sure that everything is working as expected as you’d normally do on any Raspberry Pi, but don’t attempt installing anything yet as you still don’t have an Internet connection.

    An important thing you need to do before shutting your Pi down is enabling SSH, so you can connect to it from your computer after the next boot. You can do that very easily using the raspi-config command,

    sudo raspi-config

    To enable SSH go to Interfacing Options, select SSH, choose YESOK and Finish. In case you’re asked if you want to reboot decline. After you are done shutdown your Pi and once it finishes remove the power.

    sudo shutdown -h now

    Next, you need to establish an Internet connection using the USB Ethernet adapter that you should already have. If your adapter also features a USB hub you can use it to plug your keyboard if you like, otherwise you can just connect to your Pi over SSH. Either way, keep the HDMI monitor plugged at least for now, to make sure that the boot process finishes as expected.

    Also, near the end it should also show you the IP address that your Pi got from the DHCP server. Try using this to connect to your Pi via SSH.

    ssh pi@<ip-address-of-pi>

    After successfully connecting to your Pi over SSH you no longer need the monitor and the keyboard plugged in, so feel free to unplug them if you like. At this point you should also have access to the Internet from your Pi, you can try pinging something like google.com to verify it. After making sure that you have access to the Internet it’s a good idea to update the system by running,

    sudo apt update && sudo apt upgrade
  • 3
    Configuring the Camera

    The biggest difference between a regular Raspberry Pi board and the Compute Module is that in the case of the later apart from just enabling the camera by using raspi-config, you also need a custom device tree file.

    You can find more information regarding the configuration of the Compute Module for use with a camera in the documentation. But in general, the camera connector among the others also features 4 control pins, which need to be connected to 4 GPIO pins on the Compute Module, and it is up to you to decide which ones while designing your custom board.

    In my case, while designing the board I choose CD1_SDA to go to GPIO28CD1_SCL to GPIO29CAM1_IO1 to GPIO30 and CAM1_IO0 to GPIO31. I choose these particular GPIO pins as I wanted to have a 40 pin GPIO header on my board, that also maintains compatibility with the GPIO connector of the regular Raspberry Pi boards. And for that reason I had to make sure that the GPIO pins I’m using for the camera don’t also appear in GPIO header.

    So, unless you decide to make changes on the wiring of the camera connector, you need a /boot/dt-blob.bin that tells your Pi to configure GPIO28-31 as described above. And in order to generate a dt-blob.bin, which is a binary file, you need a dt-blob.dts to compile. To make things easy I’m going to provide my own dt-blob.dts for you to use which you can then adapt to your needs if you have to.

    To compile the device tree file use the device tree compiler as follows,

    dtc -I dts -O dtb -o dt-blob.bin dt-blob.dts

    I'm not sure why but the above should result to quite a few warnings, but as long as the dt-blob.bin has been generated successfully everything should be fine. Now, move the dt-blob.bin you just generated to /boot by executing,

    sudo mv dt-blob.bin /boot/dt-blob.bin

    The above will probably give you the following warning,

    mv: failed to preserve ownership for '/boot/dt-blob.bin': Operation not permitted

    This is just mv complaining that it can’t preserve the file ownership as /boot is a FAT partition which is to be expected. You may have noticed that /boot/dt-blob.bin doesn’t exist by default, this is because the Pi uses a built in device tree instead. Adding your own inside /boot though overrides the built in one and allows you to configure the function of its pin the way you like. You can find more about the device tree in the documentation.

    After that is done you need to enable the camera,

    sudo raspi-config

    Go to Interfacing Options, select Camera, choose YESOK and Finish. In case you’re asked if you want to reboot decline. Now, shutdown your Pi and remove the power.

    After the power has been removed from the IO board, using 4 female to female jumper wires connect the pins for GPIO28 to CD1_SDAGPIO29 to CD1_SCLGPIO30 to CAM1_IO1 and GPIO31 to CAM1_IO0. Finally, attach your camera module to the CAM1 connector using the camera adapter board or a camera cable designed for the Raspberry Pi Zero and apply power.

    If everything worked as expected after the Pi boots you should be able to utilize the camera. To try to take a picture after connecting to your Pi via SSH run,

    raspistill -o test.jpeg

    If the command finishes with no errors and a test.jpeg gets created it means that it worked. If you want to have a look at the picture you just took you can connect to your Pi via SFTP and trasfer it to your computer.

    sftp pi@<ip-address-of-pi>
    sftp> get test.jpeg
    sftp> exit
    

    Attachments


       dt-blob.dts  (Download)

View all 4 instructions

Enjoy this project?

Share

Discussions

vorrias wrote 05/19/2020 at 17:19 point

Hi Rohit . It is a nice inspiration for people to use your concept and to adapt it on our M10CUBE ecosystem. 

https://hackaday.io/project/171770-m10cube

Good work also to build it with KiCAD. All our boards are in Eagle and KiCAD format too.

  Are you sure? yes | no

Rohit Prasan Mandal wrote 05/19/2020 at 17:53 point

Thanks @vorrias good work !
If i get free time I'll work on those too.

  Are you sure? yes | no

Jacob MacLeod wrote 05/13/2020 at 13:36 point

Nice! I'm doing a similar project, based on the raspberry pi zero!

  Are you sure? yes | no

Rohit Prasan Mandal wrote 05/13/2020 at 14:14 point

@Jacob MacLeod 
Thanks ! 
That's cool man ! 
let me know how is that goin' 
Best of Luck 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates