Adafruit Circuit Playground: Difference between revisions
mNo edit summary |
|||
(73 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{syllabus | ||
|is_part_of_syllabus=E-textile | |||
|do_not_show_sub_page=No | |||
|page_previous=Adafruit Wearables | |||
|page_next=MakeCode | |||
|status=to finalize | |||
|last_modification=2019/09/23 | |||
|objective=be aware of Adafruit Circuit Playground Express components, | |||
Basics of programming the board, | |||
|difficulty=beginner | |||
|see_also=Adafruit Wearables, | |||
Adafruit Circuit Playground Express, | |||
MakeCode, | |||
Adafruit GEMMA, | |||
Adafruit NeoPixel, | |||
Adafruit Sensors | |||
|cat_syllabus=e-textile | |||
}} | |||
[[fr: Adafruit Circuit Playground Express]] | |||
As of December 2019, there are three types of circuit playgrounds : the Classic, the Express, and the Bluefruit. | |||
* The classic version can run Arduino and Code.org code | |||
* the Express version (aka CPX) can run [[MakeCode]], CircuitPython, Arduino, and Code.org CS discoveries code | |||
* the Bluefruit (aka CPB) can run Arduino and CircuitPython code | |||
In this article we will present the '''Circuit playground Express''' and mention the '''Circuit Playground Bluefruit.''' | |||
== Introduction == | == Introduction == | ||
[[image:adafruit-flora-circuit-playground-express.jpg|thumb|400px|right|AdaFruit Circuit Playground Express'. Source: [https://www.flickr.com/photos/adafruit/6732237213 Flickr of AdaFruit]]] | [[image:adafruit-flora-circuit-playground-express.jpg|thumb|400px|right|AdaFruit Circuit Playground Express'. Source: [https://www.flickr.com/photos/adafruit/6732237213 Flickr of AdaFruit]]] | ||
[https://www.adafruit.com/product/3333 Circuit Playground Express] | [https://www.adafruit.com/product/3333 Circuit Playground Express] (alias "CPX") and the [https://www.adafruit.com/product/4333 Circuit Playground Bluefruit (CPB)] are boards of the [[Adafruit Wearables]] line of of [[e-textile]] products. These boards are beginner friendly since they can (also) be programmed with [[MakeCode]] and since it includes sensors, 10 LEDs, 2 push buttons, etc. and a loudspeaker in addition to the basic components (microcontroller, connectors, etc.). | ||
The | The boards are rather large and heavy compared to Adafruit's FLORA and GEMMA. However, this is compensated by their feature rich design and ease of use. | ||
* 50.6mm / ~2.0" | * 50.6mm / ~2.0" | ||
* Weight: 8.9g | * Weight: 8.9g | ||
The board can be bought in three packaging variants: | The CPX board can be bought in three packaging variants: | ||
* [https://www.adafruit.com/product/3333 Circuit Playground Express] $25, includes just the board | * [https://www.adafruit.com/product/3333 Circuit Playground Express] $25, includes just the board | ||
* [https://www.adafruit.com/product/3517 Circuit Playground Express - Base Kit], $30, includes a battery and USB cable. | * [https://www.adafruit.com/product/3517 Circuit Playground Express - Base Kit], $30, includes a battery and USB cable. | ||
* [https://www.adafruit.com/product/2769 Circuit Playground Express Advanced Pack], $100, includes 2 Playground express, threads, needles, alligator clips, a servo motor, NeoPixels, etc. | * [https://www.adafruit.com/product/2769 Circuit Playground Express Advanced Pack], $100, includes 2 Playground express, threads, needles, alligator clips, a servo motor, NeoPixels, etc. | ||
As of Nov 29 2019: (kits probably will be available soon | |||
For a class, it's probably best to buy | [https://www.adafruit.com/product/4333 Circuit Playground Bluefruit (CPB)] $25, includes just the board | ||
For a class, it's probably best to buy Base Kits ($30), either a few Advanced Packs or other FLORA extension elements, and finally some simple boards (for replacements or projects that include more than one board). | |||
Extras | Extras | ||
Line 21: | Line 49: | ||
See also: | See also: | ||
* [[Adafruit | * [[Adafruit Wearables]] (The e-textile line from which other elements like [[Adafruit NeoPixel]]s, other sensors etc. can be picked and easily connected) | ||
* [[Adafruit GEMMA]] (The tiny sister board) | |||
* [[Adafruit NeoPixel]] (connecting and programming external Adafruit LEDs) | |||
== The CPX board == | |||
Below is a picture of an Adafruit Circuit Playground Express | |||
[[image:circuit_playground_express-schema1.png|thumb|600px|none|AdaFruit Circuit Playground Express'. Photo source: [https://www.flickr.com/photos/adafruit/34783186446/in/photolist-UZEVv9-R6q9G7-PqaKgs-29G3KST-Wo62wq-21AHzQA-25Ryu1v-VznVp6-V4dFNg-26ptmHj-Wo62c7-CoP9GY-2eJLBgz-LfXq1N-LqcDwU-2bQB2R8-R6q9cj-EGjWK8-MjcTX1-2dY828L-23ibYzA-Z2mKHw-2h4jmSc-2h4gJAz-2h4gJyL-2h4iAh9-2h4gJVc-2h4iAfv-2h4gJUA-2h4gJUv-2h4gJSS-2h4gJS1-2h4gJRV-2h4iA8r-2h4gJNJ-2h4jn5m-2h4iA3B-2h4jmZS-2h4jmZg-2gFZkCH-2gFYDhw-2gFYDfc-2gFYDcS-2gFZkrv-wq8pCo-2eZ9pwf-vKX5v6-RiFQxB-EGjWTV-23t2RDq/ Adafruit Flickr] ]] | |||
=== Components and layouts === | |||
According to the [https://www.adafruit.com/product/3333 product page] (retrieved Aug 26, 2019), this board includes the following elements which are explained in detail in the [https://learn.adafruit.com/adafruit-circuit-playground-express?view=all#guided-tour guided tour.] | |||
'''Processor and basics''' | |||
* ATSAMD21 ARM Cortex M0 Processor, running at 3.3V and 48MHz | |||
* 2 MB of SPI Flash storage (i.e. a tiny disk drive), used primarily with CircuitPython to store code and libraries. | |||
* A JST battery connector (alternatively, the board also can take power from the USB connector). | |||
* Green "ON" LED so you know its powered (top left) | |||
* Red "#13" LED (D13) for basic blinking | |||
* Reset button (in the middle) | |||
* A total of 14 input/output pads ("the holes") | |||
'''Connectivity''' | |||
* MicroUSB port for programming and debugging. It can act like a serial port, keyboard, mouse, joystick or MIDI! | |||
* Infrared receiver (D26) and transmitter (D25) - can receive and transmit any remote control codes, as well as send messages between Circuit Playground Expresses. Can also act as a proximity sensor. | |||
* 14 "alligator" clip pads: a wide range of power pins, I2C, UART, Analog In, Digital In/Out, PWM, and Analog Out. | |||
'''Output:''' | |||
* 10 x mini NeoPixels (D8). These programmable LEDs can display any color. They are also used for some status information: when the bootloader is running they will turn green, or if it failed to initialize USB when connected to a computer, they will turn red). | |||
* 1 Mini speaker (A0) with class D amplifier (7.5mm magnetic speaker/buzzer). It is connected to to the A0 analog output pin. | |||
'''Input and sensors:''' | |||
* 1 Temperature sensor (A9) | |||
* 1 Light sensor (A8). Can also act as a color sensor and pulse sensor. | |||
* 1 Sound sensor (MEMS microphone) | |||
* 1 Motion sensor (D27), i.e. a LIS3DH triple-axis accelerometer with tap detection, free-fall detection. | |||
* 2 x Push buttons, labeled A (D4) and B (D5) | |||
* 1 x Slide switch (D7) | |||
* 7 of the 8 GPIO pads have capacitive touch (A1, A2, A3, A4, A5, A6, A7) | |||
'''Pads''' | |||
Below you wil find a picture whoch represent the main function of the pads (power pads OR General Purpose Input Ouput -GPIO- pads). The figure mentioned beside the pins are the a.k.a names of the GPIO pins with a "D". Indead, each GPIO pin have a surname (we have to figure out the utility of this surname but maybe it is for Arduino programming). | |||
[[File:Adafruit-detailed-pads1.jpg|500px|Adafruit Pads main functions]] | |||
''8 General Purpose Input Ouput (GPIO) pads (A0 to A7)'' | |||
* Common for all pads | |||
** ALL can be used as digital inputs, digital outputs, for LEDs, buttons, switches and also can be used as analog inputs (12-bit ADC). | |||
** ALL can be used as hardware interrupt inputs. | |||
** ALL (except A0) can be used for hardware capacitive touch. | |||
** ALL (except A0 which is shared with the speaker) are completely "free" pins with no connections with other components and you are free by programming them. | |||
* Each Pin : | |||
* A0 (a.k.a D12) : special pin can be used as an analog output for reading audio clip for example. It can be digital I/O, or analog I/O, but if you do that it will interfere with the built-in speaker. This is the only put which cannot be used as capacitive touch. | |||
* A1/D6, A2/D9, A3/D10 : pins can be digital I/O or analog input. These pins have PWM Output (Pulse With Modulation<ref>Pulse width modulation allows to vary how much time the signal is high and low. It can be used to blink the led or make gradations of light</ref> Output) and can be capacitive touch sensor. | |||
* A4/D3: pin can be digital I/O or analog input. This pin is also the I2C SCL (inter-Integrated Circuit Serial Clock line) pin and can be capacitive touch sensor. | |||
* A5/D2: pin can be digital I/O or analog input. This pin is also the I2C SDA (inter-Integrated Circuit Serial Data Line) and ca be capacitive touch sensor. | |||
* A6/D0 : pin can be digital I/O, or analog Input. This pin has PWM output, Serial Receive, and can be capacitive touch sensor | |||
* A7/D1 - This pin can be digital I/O, or analog Input. This pin has PWM output, Serial Transmit, and can be capacitive touch sensor | |||
'''''Warning''''': Each pad can provide up to 20mA. Don't connect high power component such as servos, Neopixels ... | |||
''6 Power pads'' | |||
** '''GND''' - 3 GROUND pads - interconnected using for signal / power ground connections. | |||
** '''3,3V''' - Two 3,3V output pads - used for small energy consumer components such as chips, sensors and lower power electronic components(i.e max electric intensity : 500 mA) | |||
** '''VOUT''' - 1 VOLTAGE OUTPUT pad - it will be connnected either the UBS power or the battery input and it is used for servos, Neopixels, DotStard or other high power electronic components up to 5V (i.e max electric intensity : 500mA continuous or 1 Amp peak). It contains a resettable fuse and if the fuse trips, just wait 1 minute and it will be reset. | |||
=== Packaging === | |||
As explained above, the Circuit Playground Express is available as single component ($25), as basic kit (including a USB cable, needles, AAA-battery pack, lithium battery, and some thread, $30) and as Circuit Playground Express Advanced Pack ($100). | |||
[[image:Adafruit Circuit Playground Express Base Kit.jpg|600px|none|thumb|Adafruit Circuit Playground Express Base Kit, as of Aug 2019]] | |||
=== Add ons === | |||
[[File:Adafruit-gizmo-1.jpg|300px|thumb|Circuit Playground TFT Gizmo - Bolt-on Display + Audio Amplifier]] | |||
Besides various Adafruit components that can be added, e.g. [[Adafruit NeoPixel|Neopixel]] strips, there are: | |||
* [https://www.adafruit.com/product/4367 Circuit Playground TFT Gizmo - Bolt-on Display + Audio Amplifier] ($19.95). This "thing" can be bolted to a Playground Express. Quote: Once attached you'll get a 1.54" 240x240 IPS display with backlight control, two 3-pin STEMMA connectors for attaching NeoPixel strips or servos, and a Class D audio amplifier with a Molex PicoBlade connector that can plug one of our lil speakers. As of Stp. 2019, the product is sold, but still in alpha. | |||
== The CPB board == | |||
The layout of the CPB is similar to CPX. | |||
[[File:Adafruit CPB labeled.jpg|none|thumb|600x600px|AdaFruit Playground Bluetooth (CPB)]] | |||
This board also can be programmed with MakeCode, e.g. see the [https://learn.adafruit.com/cyberpunk-santa-eye/overview Cyberpunk Santa Eye] project. | |||
So far we did not test if the CPB's Bluetooth functionality can be programmed in JavaScript/MakeCode.... | |||
== Programming the CPX board with Makecode == | |||
'''To compile and upload a program to the controller''' | |||
* Open {{goblock|[https://makecode.adafruit.com/ Makecode for Circuit Playground Express]}} | |||
* Connect the board with the USB cable | |||
* Press the reset button in the middle(for a while). See the schema above if you cannot find it.. | |||
* When it turns green, you can download the code from your browser window. | |||
'''Example''' | |||
[[image: | [[image:Adafruit Circuit Playground Express MakeCode Clap Hands.png|600px|none|thumb|Clap hands code example: Based on the "clap lights" example at [https://makecode.adafruit.com/ Makecode.adafruit.com]]] | ||
'''Javascript version''' | |||
Notice how the RDG colors are defined. E.g. red (CSS <code>#FF0000)</code> becomes <code>0xff0000 </code> | |||
== | <source lang="JavaScript"> | ||
( | input.onLoudSound(function () { | ||
light.setBrightness(20) | |||
for (let i = 0; i < 4; i++) { | |||
light.setAll(0xff0000) | |||
pause(200) | |||
light.setAll(0x000000) | |||
pause(200) | |||
} | |||
light.setPixelColor(0, 0x00ff00) | |||
light.setPixelColor(9, 0x00ff00) | |||
}) | |||
</source> | |||
'''Result after clapping''' | |||
[[image:Adafruit Circuit Playground Express MakeCode Clap Hands result.jpg|600px|none|thumb|Clap hands code example (see the Adafruit on the right of the screen)]] | |||
See also: | |||
* [[MakeCode]] (includes other examples and more information about the language) | |||
== Links == | == Links == | ||
Line 62: | Line 184: | ||
* [https://learn.adafruit.com/adafruit-circuit-playground-express?view=all Adafruit Circuit Playground Express] (in one HTML page) | * [https://learn.adafruit.com/adafruit-circuit-playground-express?view=all Adafruit Circuit Playground Express] (in one HTML page) | ||
* [https://cdn-learn.adafruit.com/downloads/pdf/adafruit-circuit-playground-express.pdf Adafruit Circuit Playground Express] (all-in-one PDF file] | * [https://cdn-learn.adafruit.com/downloads/pdf/adafruit-circuit-playground-express.pdf Adafruit Circuit Playground Express] (all-in-one PDF file] | ||
'''Tutorials''' | |||
Many hands-on tutorials are available through the online editor, e.g. the clap lights tutorial (a simpler version of our clap hands example) | |||
* https://makecode.adafruit.com/ | |||
* Youtube channel on https://www.youtube.com/channel/UCye7YlvFUUQ1dSy0WZZ1T_Q/videos (search CPX) | |||
'''Hardware''' | |||
* [https://learn.adafruit.com/adafruit-circuit-playground-express/pinouts Adafruit pinouts] (all details about pinouts, included a diagram) | |||
== Acknowledgement == | == Acknowledgement == | ||
Pictures | Pictures as well as some text was reproduced from [https://learn.adafruit.com/adafruit-circuit-playground-express?view=all the Adafruit circuit playground express documentation]. Some pictures are available under a CC BY-NC-SA license. Others are copyright AdaFruit and "all rights reserved" and reproduced with permission. Before you reuse any picture from this website, make sure to look at the license information. | ||
For more information about using Adafruit, see https://learn.adafruit.com. | |||
[[category: e-textile]] | [[category: e-textile]] | ||
<references /> |
Latest revision as of 16:48, 1 February 2023
As of December 2019, there are three types of circuit playgrounds : the Classic, the Express, and the Bluefruit.
- The classic version can run Arduino and Code.org code
- the Express version (aka CPX) can run MakeCode, CircuitPython, Arduino, and Code.org CS discoveries code
- the Bluefruit (aka CPB) can run Arduino and CircuitPython code
In this article we will present the Circuit playground Express and mention the Circuit Playground Bluefruit.
Introduction
Circuit Playground Express (alias "CPX") and the Circuit Playground Bluefruit (CPB) are boards of the Adafruit Wearables line of of e-textile products. These boards are beginner friendly since they can (also) be programmed with MakeCode and since it includes sensors, 10 LEDs, 2 push buttons, etc. and a loudspeaker in addition to the basic components (microcontroller, connectors, etc.).
The boards are rather large and heavy compared to Adafruit's FLORA and GEMMA. However, this is compensated by their feature rich design and ease of use.
- 50.6mm / ~2.0"
- Weight: 8.9g
The CPX board can be bought in three packaging variants:
- Circuit Playground Express $25, includes just the board
- Circuit Playground Express - Base Kit, $30, includes a battery and USB cable.
- Circuit Playground Express Advanced Pack, $100, includes 2 Playground express, threads, needles, alligator clips, a servo motor, NeoPixels, etc.
As of Nov 29 2019: (kits probably will be available soon
Circuit Playground Bluefruit (CPB) $25, includes just the board
For a class, it's probably best to buy Base Kits ($30), either a few Advanced Packs or other FLORA extension elements, and finally some simple boards (for replacements or projects that include more than one board).
Extras
See also:
- Adafruit Wearables (The e-textile line from which other elements like Adafruit NeoPixels, other sensors etc. can be picked and easily connected)
- Adafruit GEMMA (The tiny sister board)
- Adafruit NeoPixel (connecting and programming external Adafruit LEDs)
The CPX board
Below is a picture of an Adafruit Circuit Playground Express
Components and layouts
According to the product page (retrieved Aug 26, 2019), this board includes the following elements which are explained in detail in the guided tour.
Processor and basics
- ATSAMD21 ARM Cortex M0 Processor, running at 3.3V and 48MHz
- 2 MB of SPI Flash storage (i.e. a tiny disk drive), used primarily with CircuitPython to store code and libraries.
- A JST battery connector (alternatively, the board also can take power from the USB connector).
- Green "ON" LED so you know its powered (top left)
- Red "#13" LED (D13) for basic blinking
- Reset button (in the middle)
- A total of 14 input/output pads ("the holes")
Connectivity
- MicroUSB port for programming and debugging. It can act like a serial port, keyboard, mouse, joystick or MIDI!
- Infrared receiver (D26) and transmitter (D25) - can receive and transmit any remote control codes, as well as send messages between Circuit Playground Expresses. Can also act as a proximity sensor.
- 14 "alligator" clip pads: a wide range of power pins, I2C, UART, Analog In, Digital In/Out, PWM, and Analog Out.
Output:
- 10 x mini NeoPixels (D8). These programmable LEDs can display any color. They are also used for some status information: when the bootloader is running they will turn green, or if it failed to initialize USB when connected to a computer, they will turn red).
- 1 Mini speaker (A0) with class D amplifier (7.5mm magnetic speaker/buzzer). It is connected to to the A0 analog output pin.
Input and sensors:
- 1 Temperature sensor (A9)
- 1 Light sensor (A8). Can also act as a color sensor and pulse sensor.
- 1 Sound sensor (MEMS microphone)
- 1 Motion sensor (D27), i.e. a LIS3DH triple-axis accelerometer with tap detection, free-fall detection.
- 2 x Push buttons, labeled A (D4) and B (D5)
- 1 x Slide switch (D7)
- 7 of the 8 GPIO pads have capacitive touch (A1, A2, A3, A4, A5, A6, A7)
Pads
Below you wil find a picture whoch represent the main function of the pads (power pads OR General Purpose Input Ouput -GPIO- pads). The figure mentioned beside the pins are the a.k.a names of the GPIO pins with a "D". Indead, each GPIO pin have a surname (we have to figure out the utility of this surname but maybe it is for Arduino programming).
8 General Purpose Input Ouput (GPIO) pads (A0 to A7)
- Common for all pads
- ALL can be used as digital inputs, digital outputs, for LEDs, buttons, switches and also can be used as analog inputs (12-bit ADC).
- ALL can be used as hardware interrupt inputs.
- ALL (except A0) can be used for hardware capacitive touch.
- ALL (except A0 which is shared with the speaker) are completely "free" pins with no connections with other components and you are free by programming them.
- Each Pin :
- A0 (a.k.a D12) : special pin can be used as an analog output for reading audio clip for example. It can be digital I/O, or analog I/O, but if you do that it will interfere with the built-in speaker. This is the only put which cannot be used as capacitive touch.
- A1/D6, A2/D9, A3/D10 : pins can be digital I/O or analog input. These pins have PWM Output (Pulse With Modulation[1] Output) and can be capacitive touch sensor.
- A4/D3: pin can be digital I/O or analog input. This pin is also the I2C SCL (inter-Integrated Circuit Serial Clock line) pin and can be capacitive touch sensor.
- A5/D2: pin can be digital I/O or analog input. This pin is also the I2C SDA (inter-Integrated Circuit Serial Data Line) and ca be capacitive touch sensor.
- A6/D0 : pin can be digital I/O, or analog Input. This pin has PWM output, Serial Receive, and can be capacitive touch sensor
- A7/D1 - This pin can be digital I/O, or analog Input. This pin has PWM output, Serial Transmit, and can be capacitive touch sensor
Warning: Each pad can provide up to 20mA. Don't connect high power component such as servos, Neopixels ...
6 Power pads
- GND - 3 GROUND pads - interconnected using for signal / power ground connections.
- 3,3V - Two 3,3V output pads - used for small energy consumer components such as chips, sensors and lower power electronic components(i.e max electric intensity : 500 mA)
- VOUT - 1 VOLTAGE OUTPUT pad - it will be connnected either the UBS power or the battery input and it is used for servos, Neopixels, DotStard or other high power electronic components up to 5V (i.e max electric intensity : 500mA continuous or 1 Amp peak). It contains a resettable fuse and if the fuse trips, just wait 1 minute and it will be reset.
Packaging
As explained above, the Circuit Playground Express is available as single component ($25), as basic kit (including a USB cable, needles, AAA-battery pack, lithium battery, and some thread, $30) and as Circuit Playground Express Advanced Pack ($100).
Add ons
Besides various Adafruit components that can be added, e.g. Neopixel strips, there are:
- Circuit Playground TFT Gizmo - Bolt-on Display + Audio Amplifier ($19.95). This "thing" can be bolted to a Playground Express. Quote: Once attached you'll get a 1.54" 240x240 IPS display with backlight control, two 3-pin STEMMA connectors for attaching NeoPixel strips or servos, and a Class D audio amplifier with a Molex PicoBlade connector that can plug one of our lil speakers. As of Stp. 2019, the product is sold, but still in alpha.
The CPB board
The layout of the CPB is similar to CPX.
This board also can be programmed with MakeCode, e.g. see the Cyberpunk Santa Eye project.
So far we did not test if the CPB's Bluetooth functionality can be programmed in JavaScript/MakeCode....
Programming the CPX board with Makecode
To compile and upload a program to the controller
- Open
- Connect the board with the USB cable
- Press the reset button in the middle(for a while). See the schema above if you cannot find it..
- When it turns green, you can download the code from your browser window.
Example
Javascript version
Notice how the RDG colors are defined. E.g. red (CSS #FF0000)
becomes 0xff0000
input.onLoudSound(function () {
light.setBrightness(20)
for (let i = 0; i < 4; i++) {
light.setAll(0xff0000)
pause(200)
light.setAll(0x000000)
pause(200)
}
light.setPixelColor(0, 0x00ff00)
light.setPixelColor(9, 0x00ff00)
})
Result after clapping
See also:
- MakeCode (includes other examples and more information about the language)
Links
Official tutorials
Adafruit Circuit Playground Express documentation
- Adafruit Circuit Playground Express (several pages)
- Adafruit Circuit Playground Express (in one HTML page)
- Adafruit Circuit Playground Express (all-in-one PDF file]
Tutorials
Many hands-on tutorials are available through the online editor, e.g. the clap lights tutorial (a simpler version of our clap hands example)
- https://makecode.adafruit.com/
- Youtube channel on https://www.youtube.com/channel/UCye7YlvFUUQ1dSy0WZZ1T_Q/videos (search CPX)
Hardware
- Adafruit pinouts (all details about pinouts, included a diagram)
Acknowledgement
Pictures as well as some text was reproduced from the Adafruit circuit playground express documentation. Some pictures are available under a CC BY-NC-SA license. Others are copyright AdaFruit and "all rights reserved" and reproduced with permission. Before you reuse any picture from this website, make sure to look at the license information.
For more information about using Adafruit, see https://learn.adafruit.com.
- ↑ Pulse width modulation allows to vary how much time the signal is high and low. It can be used to blink the led or make gradations of light