3
\$\begingroup\$

I'm just getting started with electronics by way of Arduino. My Arduino kit came with a little ad for a website that takes PCB designs and prints them for you for a pretty cheap price.

But how do I get from a program that runs on the Arduino to a circuit that can be printed on a PCB? This is probably wishful thinking, but is there a mechanical way to "compile" Arduino code to a PCB layout?

Or, would I need to get someone with real EE experience to hand-design the PCB?

\$\endgroup\$
  • 4
    \$\begingroup\$ These are not the same kind of thing at all. It's like asking if you can turn your cake recipie into a building. \$\endgroup\$ – pjc50 Jan 3 '13 at 16:30
  • \$\begingroup\$ There are a lot of PCB design programs available that are free. You can use an Arduino schematic to get started (there are a bunch online) or you can even design your own board that the Arduino plugs into like this. \$\endgroup\$ – Garrett Fogerlie Jan 3 '13 at 16:46
  • 17
    \$\begingroup\$ To quote Babbage "I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." \$\endgroup\$ – NickHalden Jan 3 '13 at 16:47
  • 3
    \$\begingroup\$ Nick, no need to be nasty - I was quite clear that I'm just getting started. \$\endgroup\$ – Bill Jan 3 '13 at 19:20
  • 6
    \$\begingroup\$ @Bill Don't take it personally. Sometimes we (we = the experienced people) get complacent and take certain levels of understanding for granted. It takes questions like yours to remind us that we should not always take these things for granted, and we should keep that in mind when writing answers. \$\endgroup\$ – user3624 Jan 3 '13 at 23:50
13
\$\begingroup\$

Let's quickly define a few things:

Software: Code that executes on a computer. Yes, technically it can execute on a microcontroller such an Arduino, or even a FPGA device, but typically the term "software" refers to code meant for execution on a common device, that an end user can install/load/run.

Firmware: Code that executes on a microcontroller or similar device. Typically such code controls the behavior of an embedded electronics device and traditionally does (should) not have frequent upgrades/releases. Often firmware is not something that an end-user is expected to know how to load/execute, but sometimes they can be expected to do the upgrade (like firmware on your network router or computer's BIOS/motherboard).

Hardware: The physical components of an electronic device. This may be everything from the copper PCB and its traces, the components on it, the screws holding it to a chassis, and the chassis itself. Normally in EE we consider "hardware" to be the physical components of the board and the board itself, including wiring and connectors, but the chassis often falls under another department (structural engineering in my workplace).

When you experiment with an Arduino, you're interacting with a microcontroller (an Atmel ATMEGA most likely) and a few supporting pieces of hardware (a voltage regulator, a USB interface, a PCB and a few other bits). The code you write, I would consider "firmware" and it controls the behavior of the microcontroller.

You may decide to control an LED, or a stepper motor, or a serial port device... it's entirely up to you. The code you write, however, doesn't "know" what you're controlling, necessarily. The electrical characteristics of the hardware you decide to control is outside the scope of the firmware you write, and therefore there's no way to translate what you've written into a physical board.

You'll want to research electrical schematics and PCB layout and design, in order to move on to the prototyping and physical "hardware" stage.

Good luck!

\$\endgroup\$
7
\$\begingroup\$

No. There is no way to "compile" arduino code into a circuit. It doesn't work that way.

However, the arduino running your code is a circuit, and that circuit already does what you want. Therefore, you don't need to somehow compile the code into a dedicated circuit. Either get a arduino and dedicate it to the task, or copy its circuit and then do your own layout to get whatever form factor and mechanical details you want.

\$\endgroup\$
  • 1
    \$\begingroup\$ With the added detail, that for many applications a customized circuit can be a lot simpler than a full Arduino. \$\endgroup\$ – Chris Stratton Jan 3 '13 at 21:47
7
\$\begingroup\$

The term Arduino means a lot of things depending on context. It is an Integrated Development Environment (IDE). It is an Application Programming Interface (API) for embedded devices (primarily Atmel AVR). It is a bootloader that allows you to program the AVR over a serial interface (typically USB<->UART). It is a variety of hardware platforms that can be targetted with software written using the IDE and API, and that support the bootloader in one way or another. All of the above are open source generally speaking.

In any case, you need hardware and you need software to make the vast majority of applications work. You can have a service print you a PCB that has a spot for an AVR microcontroller and the supporting circuitry to do things like give it power, hook it up to connectors, sockets, and ports (like USB, Ethernet, or whatever), and connect all th devices and parts on the board together electrically. That board won't do a whole lot without software running on the programmable parts (i.e. the AVR).

There are a variety of ways to get your Arduino code onto your derivative board once it's been fabricated and assembled (lots of hand waving there, out of scope for this question AFAIC). You can buy an AVR pre-programmed with the Arduino bootloader. Or you can flash the bootloader onto the AVR using an ISP programmer (like an AVR ISP mk II, or even using another Arduino as an ISP programmer) if you populate a 6 pin header and connect it up appropriately. Once the bootloader is installed, you can download code onto the platform directly from the Arduino IDE over a USB (or sometimes an FTDI) cable.

In no way, shape, or form should you expect to submit C-code to a manufacturer and expect to get back a printed circuit board that implements that software.

\$\endgroup\$
5
\$\begingroup\$

Bill,

You have a conceptual misunderstanding. The code and the printed circuit board are two different things.

The code is a set of instructions to the Arduino (ATMega processor) on how to run.

The layout for a PCB are physical instructions to a machine of how to create the PCB artwork, copper,etc. It happens that to work, an Arduino system uses a PCB, but it is never the case that the code is anything close to a PCB.

If you want to use an Arduino, first you buy a board that already has all the components (and for which a layout was previously created, but you don't need to bother with it) and then you program it to do certain things.

\$\endgroup\$
0
\$\begingroup\$

If I understand your question correctly, you are wondering if you can make a dedicated circuit that runs the program you have on your Arduino. Maybe you are constrained by space in your project, for instance, or you want to integrate your code with a larger circuit. Yes, this is certainly possible, though I would not advise this for a beginner.

What you would want to do, is to make space for the microprocessor on your PCB design. (The microprocessor is the big, black chip in the right-bottom-ish on the picture below.) This is where you store and execute your Arduino program, and you may certainly make your own PCB where you can mount this component if you want. It does, however, require that you to take care of issues related to power, clock/oscillator and voltage control yourself.

The big, black chip right there is the microprocessor

Depending on your situation, I'd also consider using a small Arduino, such as the Nano or Pro Mini. These are very small, and you can even design your PCB board such that you can solder the entire Arduino on it as a composite component :-)

\$\endgroup\$
0
\$\begingroup\$

Learn about the CPU. The CPU takes input instructions and runs them against what is essentially a very small "circuit board" for the instructions your software compiles into. This can be similar with micro-controllers, only the CPU is specifically optimized and probably "over-complicated" considering the requirements of firmware.

So in essence, you can generate a circuit for your code. But it would look the same every-time regardless of the software code, unless you optimize the circuits at the input instruction level.

GPU's are particularly interesting because their over-all architecture is small, but often very optimized and efficient for specific instructions, and limit the total number of available instructions that software(which at this point is more like firmware) can compile into to(GPU shaders for example.)

For fun: Might consider inspecting ROM emulators as they're open source. It is possible to imagine and construct these instruction emulators as a circuit, and rasterize them on physical plates. You will learn a lot about CPU and how it works via digesting code and communicating with external hardware.

\$\endgroup\$
0
\$\begingroup\$

Many people use the Arduino for prototyping, often in combination with a breadboard.

For example, I've built a small circuit with a microphone and amplifier to capture sound, and connected that to the analog input of an Arduino, then wrote software to make the Arduino control a WS2812 LED strip connected to a digital output in response to the volume.

This is fine as a proof of concept, but not something I'd install in my home -- for one, it is fairly large, and also I'd like to get my breadboard back. So I've designed a small PCB that contains just the components from the Arduino board that I need, removing all others, and adding the ones that are on the breadboard.

I can still connect the standard Arduino programmer to that board, and the Arduino software doesn't know the difference -- however the board is a lot smaller, and there are no free-hanging cables, everything is a single board.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.