# Adafruit ATECC608 Breakout

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/080/272/medium800/adafruit_products_ATECC608_Top.jpg?1567193852)

You've got secrets, and you want to keep them safe? Most microcontrollers are not designed to protect against snoopers, but a crypto-authentication chip can be used to lock away private keys securely. Once the private key is saved inside, it can't be read out, all you can do is send it challenge-response queries. That means that even if someone gets hold of your hardware and can read back the firmware, they won't be able to extract the secret!

![](https://cdn-learn.adafruit.com/assets/assets/000/080/273/medium800/adafruit_products_ATECC608_Lock.jpg?1567193866)

The ATECC608 is the latest crypto-auth chip from Microchip, and it uses I2C to send/receive commands. Once you 'lock' the chip with your details, you can use it for ECDH and AES-128 encrypt/decrypt/signing. There's also hardware support for random number generation, and SHA-256/HMAC hash functions to greatly speed up a slower micro's cryptography commands.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/274/medium800/adafruit_products_ATECC608_Top_Angle.jpg?1567193880)

We're starting to see these low-cost secure element chips in various products, so that a less expensive chip can be used to drive peripherals, without worrying about security. This chip does not have a public datasheet, [but it is compatible with the ATECC508 earlier version which does, so please refer to that complete datasheet](https://www.microchip.com/wwwproducts/en/ATECC508A) as well [as the ATECC608 summary sheet](https://www.microchip.com/wwwproducts/en/ATECC608A). &nbsp; The good news is that, despite not having complete documentation, there _is_ some software support. [For Arduino use, check out the Arduino ATECCx08 library](https://github.com/arduino-libraries/ArduinoECCX08). [For Python and C/C++ check out Microchips Cryptoauthlib](https://github.com/MicrochipTech/cryptoauthlib)(yes we also think it's odd that there's no datasheet but there is published code)

![](https://cdn-learn.adafruit.com/assets/assets/000/080/275/medium800/adafruit_products_ATECC608_Top_Header.jpg?1567193895)

To make working with the ATECC608 as easy as possible, we've put it on a breakout PCB with the required support circuitry and [SparkFun qwiic](https://www.sparkfun.com/qwiic) compatible [**STEMMA QT**](https://learn.adafruit.com/introducing-adafruit-stemma-qt) connectors. This allows you to use it with other similarly equipped boards **without needing to solder.** &nbsp;This chip will work with 3.3V or 5V power/logic micros, so it's ready to get to work with a range of development boards.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/276/medium800/adafruit_products_ATECC608_with_Feather.jpg?1567193916)

 **Please note the I2C address is fixed at 0x60 and according to Microchip, you should use this at higher I2C speeds like 400KHz if other devices are on the I2C bus, to avoid some I2C bus contention** (much like the datasheet, this is not documented anywhere yet).

![](https://cdn-learn.adafruit.com/assets/assets/000/080/277/medium800/adafruit_products_ATECC608_Back.jpg?1567193926)

**[Clear Padlock](https://www.adafruit.com/product/3804) and [STEMMA QT cable](https://www.adafruit.com/product/4209) not included (but we have them in the shop!)**

# Adafruit ATECC608 Breakout

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/080/301/medium800/adafruit_products_ATECC608_Top_pinouts.jpg?1567196354)

## Power Pins

- **Vcc** - this is the power pin. You can use 3.3V or 5V. Be sure to use the same power level as the logic level on your board - e.g. for a 5V microcontroller like Arduino, use 5V.
- **GND** - common ground for power and logic.

## I2C Logic Pins

- **SCL** - this is the I2C clock pin, connect to your microcontroller I2C clock line.
- **SDA** - this is the I2C data pin, connect to your microcontroller I2C data line.
- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt)&nbsp;-** These connectors allow you to connectors to dev boards with&nbsp; **STEMMA QT** connectors or to other things with&nbsp;[various associated accessories](https://www.adafruit.com/?q=JST%20SH%204).

Warning: 

# Adafruit ATECC608 Breakout

## Python & CircuitPython

It's easy to use the ATECC608 with CircuitPython and the&nbsp;[Adafruit CircuitPython ATECC](https://github.com/adafruit/Adafruit_CircuitPython_ATECC)&nbsp;module.&nbsp; This module allows you to easily write Python code that can communicate with the ATECC608 module.&nbsp;  
  
You can use this sensor with any CircuitPython microcontroller board or with a Linux single board computer that has GPIO and Python&nbsp;[thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

## CircuitPython Microcontroller Wiring
Wiring the ATECC608 is easy, since it only requires power and two wires for an I2C connection. Additionally, the STEMMA QT connectors give you additional solderless options for wiring:

- **Board 3V** &nbsp;to&nbsp;**sensor VIN (red wire)**
- **Board GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Board SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Board SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_feather_atecc_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/081/013/medium640/adafruit_products_feather_atecc_bb.png?1568748842)

![adafruit_products_feather_atecc_bb_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/081/015/medium640/adafruit_products_feather_atecc_bb_bb.png?1568749238)

## Python Computer Wiring

Since there's&nbsp;_dozens_&nbsp;of Linux computers/boards you can use we will show wiring for&nbsp;[Raspberry Pi](https://www.adafruit.com/product/3055). For other platforms,&nbsp;[please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).&nbsp;

Here's the Raspberry Pi wired with I2C:

- **Pi 3V** &nbsp;to&nbsp;**sensor VIN (red wire)**
- **Pi GND** &nbsp;to&nbsp;**sensor GND (black wire)**
- **Pi SCL** &nbsp;to&nbsp;**sensor SCL (yellow wire)**
- **Pi SDA** &nbsp;to&nbsp;**sensor SDA (blue wire)**

![adafruit_products_pi_atecc_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/081/025/medium640/adafruit_products_pi_atecc_bb.png?1568751739)

![adafruit_products_pi_atecc_bb_full.png](https://cdn-learn.adafruit.com/assets/assets/000/081/026/medium640/adafruit_products_pi_atecc_bb_full.png?1568751968)

## CircuitPython Installation of the ATECC Library

You'll need to install the&nbsp;[Adafruit CircuitPython ATECC](https://github.com/adafruit/Adafruit_CircuitPython_ATECC)&nbsp;library on your CircuitPython board.

First make sure you are running the&nbsp;[latest version of Adafruit CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython)&nbsp;for your board.

Next you'll need to install the necessary libraries&nbsp;to use the hardware--carefully follow the steps to find and install these libraries from&nbsp;[Adafruit's CircuitPython library bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases).&nbsp; Our CircuitPython starter guide has&nbsp;[a great page on how to install the library bundle](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).

For non-express boards like the Trinket M0 or Gemma M0, you'll need to manually install the necessary libraries from the bundle:

- **adafruit\_atecc.mpy**
- **adafruit\_atecc\_asn1.mpy**
- **adafruit\_atecc\_cert\_util.mpy**
- **adafruit\_binascii**
- **adafruit\_bus\_device**

Before continuing make sure your board's&nbsp; **lib** folder or root filesystem has the **adafruit\_atecc.mpy, adafruit\_atecc\_asn1.mpy, adafruit\_atecc\_cert\_util.mpy,**  **adafruit\_binascii&nbsp;** and&nbsp; **adafruit\_bus\_device** &nbsp;files and folders **&nbsp;** copied over.

Next&nbsp;[connect to the board's serial REPL&nbsp;](https://learn.adafruit.com/welcome-to-circuitpython/the-repl)so you are at the CircuitPython&nbsp;`>>>`&nbsp;prompt.

## Python Installation of ATECC Library

You'll need to install the&nbsp; **Adafruit\_Blinka** &nbsp;library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3.&nbsp;[Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `sudo pip3 install adafruit-circuitpython-atecc`

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython and Python Usage

To demonstrate the power of the ATECC co-processor, you'll initialize it, generate a random number, print (and increase) one of the co-processor's internal counters, and perform a SHA-256 hash operation.

**Copy the following code to the `code.py`&nbsp;file on your CircuitPython device:**

https://github.com/adafruit/Adafruit_CircuitPython_ATECC/blob/main/examples/atecc_simpletest.py

 **Save the file and open the board's REPL**. You should see the following output:

![](https://cdn-learn.adafruit.com/assets/assets/000/081/019/medium800/adafruit_products_Mu_1_0_2_-_code_py.png?1568749742)

The ATECC will output its serial number and a random value to the REPL. You can modify the call to `atecc.random()` in your code to specify a minimum or maximum integer value to generate.

```auto
print("ATECC Serial: ", atecc.serial_number)

# Generate a random number with a maximum value of 1024
print("Random Value: ", atecc.random(rnd_max=1024))
```

The code also writes a value of one of the ATECC's hardware counters to the REPL. This code uses counter #1, there's two hardware counters built into the ATECC chip.

If you run the file again (by saving it), you'll notice the counter value increase. The counter's state is saved, even if the ATECC is powered off. If you're building an IoT project, you can save important state information in here, such as the last frame which was transmitted before the connection was lost.

```auto
print("ATECC Counter #1 Value: ", atecc.counter(1, increment_counter=True))
```

The ATECC is capable of performing hashing using the SHA256 algorithm. Instead of using a slow python-based SHA256 hash algorithm (such as the one found within [CircuitPython's hashlib module](https://github.com/adafruit/Adafruit_CircuitPython_hashlib)), you can use the ATECC's super-quick hardware to hash data for you!

CircuitPython\_ATECC implements a [CPython3 hashlib-like](https://docs.python.org/3/library/hashlib.html) interface. First, initialize the SHA256 calculate engine and memory context of the ATECC chip.

```auto
# Initialize the SHA256 calculation engine
atecc.sha_start()
```

Then, can append bytes to hash object by passing bytes to&nbsp;`sha_update`. You can append as many bytes as you'd like before you create a message digest.&nbsp;

```auto
# Append bytes to the SHA digest
print("Appending to the digest...")
atecc.sha_update(b"Nobody inspects")

print("Appending to the digest...")
atecc.sha_update(b" the spammish repetition")

```

The digest of the data passed to the `sha_update()`&nbsp; method is then returned and printed to the REPL.

```auto
# Return the digest of the data passed to sha_update
message = atecc.sha_digest()
print("SHA Digest: ", message)
```

## Self-Signed Certificate Demo

This demo will generate a self signed certificate for a private key generated by your crypto chip.&nbsp;

**Copy the code below to your `code.py` file.&nbsp;**

https://github.com/adafruit/Adafruit_CircuitPython_ATECC/blob/main/examples/atecc_csr.py

 **Save the file** and **open the board's REPL**. You should see the following output:

```auto
ATECC Serial Number:  012347A22713EAFCEE
The ATECC is not locked, set LOCK_ATECC to True in code.py.
```

You'll want to **edit the following lines in** `code.py` before generating a certificate signing request.

```auto
# -- Enter your configuration below -- #

# Lock the ATECC module when the code is run?
LOCK_ATECC = False
# 2-letter country code
MY_COUNTRY = "US"
# State or Province Name
MY_STATE = "New York"
# City Name
MY_CITY = "New York"
# Organization Name
MY_ORG = "Adafruit"
# Organizational Unit Name
MY_SECTION = "Crypto"
# Which ATECC slot (0-4) to use
ATECC_SLOT = 0
# Generate new private key, or use existing key
GENERATE_PRIVATE_KEY = True

# -- END Configuration, code below -- #
```

Once the configuration in code.py looks correct, **change the following line from:**

`LOCK_ATECC = False`&nbsp;

**to**

`LOCK_ATECC = True`&nbsp;

This will **permanently** lock your chip. You will only need to set this once.

**Save and run your code**. You should see the following output:

```auto
ATECC Serial Number:  012347A22713EAFCEE
Writing default configuration to the device...
Wrote configuration, locking ATECC module...
ATECC locked!

Generating Certificate Signing Request...
-----BEGIN CERTIFICATE REQUEST-----

MIIBMDCB1gIBADB0MQswCQYDVQQGEwJVUzERMA8GA1UECBMITmV3IFlvcmsxETAPBgNVBAcTCE5ldyBZb3JrMREwDwYDVQQKEwhBZGFmcnVpdDEPMA0GA1UECxMGQ3J5cHRvMRswGQYDVQQDExIwMTIzNDdBMjI3MTNFQUZDRUUwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARAFWZ0TDXKl0iks2NnMZOhQA3XYG/F6wFUfDIuabu8/nsSW6gtNq2UJi559OpgXsEkNMkUeqkaJLWFvn3hIKQHoAAwCgYIKoZIzj0EAwIDSQAwRgIhAJ6CZ2EQQ/838lD35O3yBoMloNVY4F47xveXF2ccDFCLAiEA8/kFUQXfbjgixSasozi3JsBsT4V03ER5P+zcSTUZ6Ns=

-----END CERTIFICATE REQUEST-----

```

The ATECC608A will quickly generate a certificate signing request and output it to the REPL.

# Adafruit ATECC608 Breakout

## Arduino

## Wiring&nbsp;
- Connect&nbsp; **&nbsp;**** Metro or Arduino&nbsp; ****5V** &nbsp;to&nbsp; **board&nbsp;**** Vcc**
- Connect&nbsp; **Metro or Arduino** &nbsp; **GND** &nbsp;to&nbsp; **board&nbsp;**** GND**
- Connect&nbsp; **Metro or Arduino** &nbsp; **SDA** &nbsp;to&nbsp; **board SDA**
- Connect&nbsp; **Metro or Arduino** &nbsp; **SCL** &nbsp;to&nbsp; **board SCL**

![adafruit_products_ATECC608_Metro_Arduino_bb.png](https://cdn-learn.adafruit.com/assets/assets/000/080/308/medium640/adafruit_products_ATECC608_Metro_Arduino_bb.png?1567205458)

Warning: 

## Installation

Arduino [created an ECCX08 library](https://github.com/arduino-libraries/ArduinoECCX08) which can generate a random number, generate a self-signed certificate, and generate a JSON Web Token (JWT).

Click the&nbsp; **Manage Libraries ...** &nbsp;menu item, search for&nbsp; **Arduino ECCX08** ,&nbsp;and select the&nbsp; **ArduinoECCX08** &nbsp;library:

![](https://cdn-learn.adafruit.com/assets/assets/000/080/278/medium800/adafruit_products_Library_Manager.png?1567194107)

## Random Number Demo

This demo demonstrates the ATECC608's ability to quickly generate a random number.&nbsp;

Open up&nbsp; **File -\> Examples -\> ECCX08&nbsp;**** -\>&nbsp;ECCX08RandomNumber&nbsp;**and upload to your Arduino wired up to the breakout.

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 9600 baud.&nbsp;You should see a new randomly generated number printing to the serial monitor every second.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/280/medium800/adafruit_products__dev_cu_usbmodem141224241.png?1567194482)

Now you know that the board is working!

## Self-Signed Certificate Demo

This demo will generate a self signed certificate for a private key generated by your crypto chip.&nbsp;

Open up&nbsp; **File -\> Examples -\> ECCX08&nbsp;**** -\> Tools -\>&nbsp;ECCX08SelfsignedCert** and upload to your Arduino wired up to the breakout.

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 9600 baud.&nbsp;

If the chip is not locked, you will be prompted to lock it.

```auto
The ECCX08 on your board is not locked, would you like to PERMANENTLY configure and lock it now? (y/N)"

```

 **Type Y into the serial monitor and press the enter key**. This will **permanently** lock your chip. You will only do this once.

The code will ask you to **enter the issue year of the certificate into the serial monitor. Click send**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/291/medium800/adafruit_products__dev_cu_usbmodem141224241.png?1567195792)

 **Enter the issue month** of the certificate into the serial monitor. **Click send**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/292/medium800/adafruit_products__dev_cu_usbmodem141224241.png?1567195820)

 **Enter the issue day** of the certificate into the serial monitor. **Click send**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/293/medium800/adafruit_products__dev_cu_usbmodem141224241.png?1567195844)

**Enter the issue hour (the current hour, in _24_ hour time)**&nbsp;of the certificate into the serial monitor. **Click send**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/305/medium800/adafruit_products_Pasted_Image_8_30_19__4_22_PM.png?1567196600)

Certificates are only valid for a fixed period of time. **Enter how many years the certificate is valid** for, then **click send**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/304/medium800/adafruit_products_Pasted_Image_8_30_19__4_22_PM.png?1567196554)

The ATECC608A can store up to 5 private keys. **Select the slot you'd like to use for the private key and click send**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/296/medium800/adafruit_products__dev_cu_usbmodem141224241.png?1567195927)

The issue date, expiration date, and signature are stored in a different slot on the ATECC608A. **Select a slot to use for storing these values**.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/298/medium800/adafruit_products__dev_cu_usbmodem141224241_and_ECCX08SelfSignedCert___Arduino_1_8_9.png?1567195985)

 **Enter _Y_ into the serial monitor to generate a new private key**. If you have a previous private key stored on the ATECC608A, **enter _n&nbsp;into the serial monitor_ to use a key you previously generated** and stored in a slot.

![](https://cdn-learn.adafruit.com/assets/assets/000/080/303/medium800/adafruit_products_Pasted_Image_8_30_19__4_21_PM.png?1567196524)

The ATECC608A will quickly generate a self signed certificate and display it on the serial monitor. It'll also include a SHA1 hash for verifying the certificate.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/080/300/medium800/adafruit_products__dev_cu_usbmodem141224241.png?1567196068)

# Adafruit ATECC608 Breakout

## Downloads

## Files

- [ATECC608A Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/40001977A.pdf)
- [ATECC508A Data Sheet (full) - the ATECC608A full datasheet is under NDA, but this datasheet is considered a 'subset' and can be used for reference!](https://www.microchip.com/wwwproducts/en/ATECC508A)
- [EagleCAD files on GitHub](https://github.com/adafruit/Adafruit-ATECC608-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20ATECC608.fzpz)

## Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/080/307/medium800/adafruit_products_ATECC608_Fab_Print.png?1567205020)

## Schematic
![](https://cdn-learn.adafruit.com/assets/assets/000/080/306/medium800/adafruit_products_ATECC608_Sch.png?1567205011)


## Primary Products

### Adafruit ATECC608 Breakout Board - STEMMA QT / Qwiic

[Adafruit ATECC608 Breakout Board - STEMMA QT / Qwiic](https://www.adafruit.com/product/4314)
You've got secrets, and you want to keep them safe? Most microcontrollers are not designed to protect against snoopers, but a crypto-authentication chip can be used to lock away private keys securely. Once the private key is saved inside, it can't be read out, all you can do is send it...

In Stock
[Buy Now](https://www.adafruit.com/product/4314)
[Related Guides to the Product](https://learn.adafruit.com/products/4314/guides)

## Featured Products

### STEMMA QT / Qwiic JST SH 4-pin to Premium Male Headers Cable

[STEMMA QT / Qwiic JST SH 4-pin to Premium Male Headers Cable](https://www.adafruit.com/product/4209)
This 4-wire cable is a little over 150mm / 6" long and fitted with JST-SH female 4-pin connectors on one end and premium Dupont male headers on the other. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4209)
[Related Guides to the Product](https://learn.adafruit.com/products/4209/guides)
### STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long

[STEMMA QT / Qwiic JST SH 4-pin Cable - 100mm Long](https://www.adafruit.com/product/4210)
This 4-wire cable is a little over 100mm / 4" long and fitted with JST-SH female 4-pin connectors on both ends. Compared with the chunkier JST-PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/4210)
[Related Guides to the Product](https://learn.adafruit.com/products/4210/guides)

## Related Guides

- [All the Internet of Things - Episode Five: The S in IoT is for Security](https://learn.adafruit.com/all-the-internet-of-things-episode-five-the-s-in-iot-is-for-security.md)
- [AD8495 Analog Output K-Type Thermocouple Amplifier](https://learn.adafruit.com/ad8495-thermocouple-amplifier.md)
- [Adafruit Voice Bonnet](https://learn.adafruit.com/adafruit-voice-bonnet.md)
- [Adafruit High Power Infrared LED Emitter](https://learn.adafruit.com/adafruit-high-power-infrared-led-emitter.md)
- [ESP32-S3 BLE RS-232 Controller](https://learn.adafruit.com/esp32-s3-ble-rs232-controller.md)
- [2.3" Monochrome 128x32 OLED Display Module](https://learn.adafruit.com/2-3-monochrome-128x32-oled-display-module.md)
- [Adafruit Slider Trinkey](https://learn.adafruit.com/adafruit-slider-trinkey.md)
- [Adafruit SCD-30 - NDIR CO2 Temperature and Humidity Sensor](https://learn.adafruit.com/adafruit-scd30.md)
- [4x4 Rotary Encoder MIDI Messenger](https://learn.adafruit.com/4x4-rotary-encoder-midi-messenger.md)
- [Make your own PCB with Eagle, OSH Park, and Adafruit!](https://learn.adafruit.com/making-pcbs-with-oshpark-and-eagle.md)
- [Adafruit TMP119 High-Precision Temperature Sensor](https://learn.adafruit.com/adafruit-tmp119-high-precision-temperature-sensor.md)
- [Adafruit LPS28 Pressure Sensor](https://learn.adafruit.com/adafruit-lps28-pressure-sensor.md)
- [Adafruit Pro Trinket LiPoly/LiIon Backpack](https://learn.adafruit.com/adafruit-pro-trinket-lipoly-slash-liion-backpack.md)
- [Adafruit Mini TFT with Joystick Featherwing](https://learn.adafruit.com/adafruit-mini-tft-featherwing.md)
- [Adafruit Data Logger Shield](https://learn.adafruit.com/adafruit-data-logger-shield.md)
