User Tools

Site Tools


arduino:diy_ardunio:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
arduino:diy_ardunio:start [2015/03/19 16:43] – [Uploading sketches] mithatarduino:diy_ardunio:start [2016/08/28 18:33] (current) – [Burning the bootloader] mithat
Line 9: Line 9:
 ===== Setting up for programming ===== ===== Setting up for programming =====
  
-When you buy a premade Arduino, the microcontroller comes preprogrammed with a bootloader. Your premade Arduino also has USB circuitry on it that lets you upload sketches via USB from a host computer. When making your own standalone Arduinos, you are going to need a way to to burn the bootloader onto the virgin microcontrollers, and you'll need a way to upload sketches to the Arduino after you've burned the bootloader. There are a few ways to do both these. Here's what appeals to me.+When you buy a premade Arduino, the microcontroller comes preprogrammed with a bootloader. Most premade Arduinos also have USB circuitry on them that lets you upload sketches via USB from a host computer.((The [[https://www.arduino.cc/en/Main/ArduinoBoardProMini|Pro Mini]] is probably the best-known exception.)) When making your own standalone Arduinos, you are going to need a way to to burn the bootloader onto the virgin microcontroller, and you'll need a way to upload sketches to the Arduino after you've burned the bootloader. There are a few ways to do these. Here's what appeals to me.
  
 ==== Burning the bootloader ==== ==== Burning the bootloader ====
Line 17: Line 17:
 You can use an Arduino board to burn the bootloader onto new chips.((See "Burning the Bootloader" in [[http://arduino.cc/en/Tutorial/ArduinoToBreadboard|From Arduino to a Microcontroller on a Breadboard]].)) Since you'll only do this once per device, this setup might not be too inconvenient. Making a shield with a ZIF socket would simplify things greatly and reduce the chances for errors. You can use an Arduino board to burn the bootloader onto new chips.((See "Burning the Bootloader" in [[http://arduino.cc/en/Tutorial/ArduinoToBreadboard|From Arduino to a Microcontroller on a Breadboard]].)) Since you'll only do this once per device, this setup might not be too inconvenient. Making a shield with a ZIF socket would simplify things greatly and reduce the chances for errors.
  
-You can get cards/adapters that you can use instead of an Arduino((See "Bootloading your chips OPTIONAL" in [[http://arduino.cc/en/Main/Standalone|Building an Arduino on a Breadboard]])), but I think an Uno, possibly with a custom shield, will work just fine for my needs--particularly since this method is supported by Arduino itself. The other methods might make more sense if you are using an SMD microcontroller and/or want to burn the bootloader while the microcontroller is in circuit.+You can get cards/adapters that you can use instead of an Arduino((See "Bootloading your chips OPTIONAL" in [[http://arduino.cc/en/Main/Standalone|Building an Arduino on a Breadboard]])), but I think an Uno, possibly with a custom shield, makes a lot of sense in general--particularly since this method is supported by Arduino itself. The other methods might make more sense if you are using an SMD microcontroller and/or want to burn the bootloader while the microcontroller is in circuit.
  
 === Nonstandard Arduinos === === Nonstandard Arduinos ===
Line 32: Line 32:
 I think a better approach is to buy an inexpensive USB to serial cable/adapter. Apparently, it can't be just any old serial to USB adapter; the Arduino needs to be reset by the host when new sketches are uploaded, and it appears the serial DTR pin is used for this.((http://blog.tarn-vedra.de/posts/using-cp2102.html)) So, //make sure the board you buy has a DTR output.// I think a better approach is to buy an inexpensive USB to serial cable/adapter. Apparently, it can't be just any old serial to USB adapter; the Arduino needs to be reset by the host when new sketches are uploaded, and it appears the serial DTR pin is used for this.((http://blog.tarn-vedra.de/posts/using-cp2102.html)) So, //make sure the board you buy has a DTR output.//
  
-The classic chip for USB to serial conversion is the FTDI FT232RL((Beware of counterfeits! See [[http://hackaday.com/2014/02/19/ft232rl-real-or-fake/|this]] and [[http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/|this]]!)). I believe these were used in earlier Arduinos. [[http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf|Recent Unos]] use an ATmega16U2-MU with custom software. +The classic chip for USB to serial conversion is the FTDI FT232RL((Beware of counterfeits! See [[http://hackaday.com/2014/02/19/ft232rl-real-or-fake/|this]] and [[http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/|this]]!)). I believe these were used in earlier Arduinos. [[http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf|Recent Unos]] use an ATmega16U2-MU with custom software. Note that the FTDI FT232RL requires custom drivers on Windows---ones that may [[http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/|brick the unit]] if the driver thinks the chip is a fake! There are some low cost alternatives to the FT232RL that promise to work as well and may have better driver support (depending on your platform).
- +
-Note that the FTDI FT232RL requires custom drivers on Windows--ones that may [[http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/|brick the unit]] if the driver thinks the chip is a fake! There are some low cost alternatives to the FT232RL that promise to work as well and may have better driver support (depending on your platform).+
  
 Some options for USB to serial adapters appear to include: Some options for USB to serial adapters appear to include:
  
   * Arduino's own [[http://arduino.cc/en/Main/USBSerial|USB Serial Light Adapter]] (Atmega8U2-based)   * Arduino's own [[http://arduino.cc/en/Main/USBSerial|USB Serial Light Adapter]] (Atmega8U2-based)
-  * SparkFun's [[https://www.sparkfun.com/products/9716|FTDI Basic Breakout]] (FT232RL-based) +  * SparkFun's [[https://www.sparkfun.com/products/9716|FTDI Basic Breakout]] or [[https://www.sparkfun.com/products/11736|FT231X Breakout]] (FT232RL-based) 
-  * CP2102-based boards like [[http://www.ebay.com/itm/6Pin-USB-2-0-to-TTL-UART-Module-Serial-Converter-CP2102-STC-Replace-Ft232-Module-/400565980256?pt=LH_DefaultDomain_0&hash=item5d4397cc60|this one]].+  * CP2102-based boards like [[http://www.ebay.com/itm/CP2102-USB-RS232-TTL-Adapter-5V-3-3V-for-Arduino-5-Pin-Linux-MAC-US-SHIP-/181538880234?pt=LH_DefaultDomain_0&hash=item2a448f7aea|this one]] or [[http://www.ebay.com/itm/6Pin-USB-2-0-to-TTL-UART-Module-Serial-Converter-CP2102-STC-Replace-Ft232-Module-/400565980256?pt=LH_DefaultDomain_0&hash=item5d4397cc60|this one]].
   * CH340-based boards like[[http://www.ebay.com/itm/Replace-PL2303-USB-TO-TTL-232-RS232-Serial-Port-CH340-for-Arduino-PIC-AVR-Modbus-/281097665582?pt=LH_DefaultDomain_0&hash=item4172b9fc2e|this one]].   * CH340-based boards like[[http://www.ebay.com/itm/Replace-PL2303-USB-TO-TTL-232-RS232-Serial-Port-CH340-for-Arduino-PIC-AVR-Modbus-/281097665582?pt=LH_DefaultDomain_0&hash=item4172b9fc2e|this one]].
  
-The CH340 in particular seems to be taking off with Arduino clone makers--possibly because it's both cheap and has no dramatic driver issues on Windows. However, sourcing the proper CH340 drivers seems to be a bit muddled and not exactly confidence inspiring.+The CH340 in particular seems to be taking off with Arduino clone makers---possibly because it's both cheap and has no dramatic driver issues on Windows. However, sourcing the proper CH340 drivers seems to be a bit muddled and not exactly confidence inspiring.
  
-^ IC      ^   ^ Linux driver ^ Windows driver   ^ MacOS driver ^ +^ IC      ^ I/O  ^ Linux driver ^ Windows driver   ^ MacOS driver ^ 
-| FT232RL | ?   | Buit-in or [[http://www.ftdichip.com/Drivers/VCP.htm|FTDI]] | [[http://www.ftdichip.com/Drivers/VCP.htm|FTDI]] | [[http://www.ftdichip.com/Drivers/VCP.htm|FTDI]] |+| FT232RL | Selectable 3.3V or 5V | Buit-in or [[http://www.ftdichip.com/Drivers/VCP.htm|FTDI]] | [[http://www.ftdichip.com/Drivers/VCP.htm|FTDI]] | [[http://www.ftdichip.com/Drivers/VCP.htm|FTDI]] |
 | CP2102  | 3.3V; 5V tolerant and TTL capable | Built-in or [[https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx | Silicon Labs]] | [[https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx | Silicon Labs]] | [[https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx | Silicon Labs]] | | CP2102  | 3.3V; 5V tolerant and TTL capable | Built-in or [[https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx | Silicon Labs]] | [[https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx | Silicon Labs]] | [[https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx | Silicon Labs]] |
 | CH340   | ?   | Built-in | Microsoft Update?((http://catalog.update.microsoft.com/v7/site/ScopedViewRedirect.aspx?updateid=be9c8169-b12b-475f-81b8-3d3e69181e8c)) | Available but broken in Yosemite(([[http://hackaday.com/2014/12/02/finding-a-cheaper-usb-to-serial-chips/]])) | | CH340   | ?   | Built-in | Microsoft Update?((http://catalog.update.microsoft.com/v7/site/ScopedViewRedirect.aspx?updateid=be9c8169-b12b-475f-81b8-3d3e69181e8c)) | Available but broken in Yosemite(([[http://hackaday.com/2014/12/02/finding-a-cheaper-usb-to-serial-chips/]])) |
  
-Make sure the I/O levels of the adapter are compatible with the microcontroller you are programming. FIXME Are Atmega programming inputs TTL capable?If your adapter card has 5V or 3.3V outputs available, you can use that to power your 5V or 3.3V microcontroller if needed. +Make sure the I/O levels of the adapter are compatible with the microcontroller you are programming. FIXME //Are Atmega programming inputs TTL capable? If not, will they work with the 3.3V CP2102 outputs when working at 5V?// If your adapter card has 5V or 3.3V outputs available, you can use that to power your 5V or 3.3V microcontroller if needed. 
  
 Connect the data pins as follows: Connect the data pins as follows:
Line 60: Line 58:
 |DTR              | Reset, through a 100nF capacitor* | |DTR              | Reset, through a 100nF capacitor* |
  
-*The reset pin on the microcontroller should have a 10K pullup resistor on it. The 100nF capacitor takes the adapter's DTR output and converts it into a pulse. The [[https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Arduino-Pro-Mini-v14.pdf|Arduino Pro Mini]] has both these already in place, so you can connect the adapter's DTR to the Pro Mini's DTR header pin directly.+*The 100nF capacitor takes the adapter's DTR output and converts it into a pulse. The reset pin on the microcontroller should also have a 10K pullup resistor on it. The [[https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Arduino-Pro-Mini-v14.pdf|Arduino Pro Mini]] has both these already in place, so you can connect the adapter's DTR to the Pro Mini's DTR header pin directly.
  
 As far as I know, you can use the Arduino IDE to upload sketches as normal with this setup. As far as I know, you can use the Arduino IDE to upload sketches as normal with this setup.
  
-This video is instructive.+This video is instructive:
  
 {{youtube>Vawhrr4COjI}} {{youtube>Vawhrr4COjI}}
 +
 +===== KiCad subcircuit =====
 +For (temporary?) safe keeping, here's a hierarchical [[Arduino Uno subcircuit]] for incorporating a DIY-Arduino in a PCB design. It requires some of my [[https://gitlab.com/mithat/kicad-components-mfk|KiCad libraries]].
 +
  
 ===== Some references ===== ===== Some references =====
arduino/diy_ardunio/start.1426783399.txt.gz · Last modified: 2015/03/19 16:43 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki