Introduction: Computer Controlled Tinkering W/o Writing Code

WHY DOES THIS PROJECT EXIST?

Sometimes you just want to throw together something quickly that requires the power of a microprocessor but you don't want to use your laptop with your development environment on it and don't really want to write any code. You just want to directly jump to tinkering.

I don't pretend to say that this replaces anything close to all the reasons you need to write code, but it does provide enough functionality that if you have a Circuit Playground Express and some sort of electronics kit (like a Tronex or Snap Circuit kit) and maybe a servo and a handful of K'nex or popsicle sticks, cardboard, and glue, you can do some really fun and useful things in a very short period of time which makes it easy to play with your ideas without getting bogged down in the design.

This project uses Adafruit's Circuit Playground Express which is already pretty cool in and of itself with its built-in programmable color changing LEDs, buttons, and sensors. If you have got an already provisioned RTPlayground2 Inventor's Kit from Reach and Teach, you can skip to Step 4. (You may also want to skip to Step 4 to see how this kit can be used before building this project.)

WHAT DOES THIS DO?

After downloading code into a Circuit Playground Express (with CircuitPython loaded on it), you can select 5 built-in functions:

  • Pgm 0: Automatically cycle a motor or any other circuit ON/OFF or turn a servo back and forth
  • Pgm 1: Use sound or any IR remote control to turn a motor or circuit ON/OFF or activate a servo
  • Pgm 2: Use light to control a motor, circuit, or servo
  • Pgm 3: Variable control a circuit or servo using an external potentiometer knob or other voltage source
  • Pgm 4: Turn a motor or circuit ON/OFF or activate servo using color coded cards (Green or Red)

The code is written in CircuitPython to make it easy to change it should you desire to do so. One caveat on this, I have pushed the limit on the amount of RAM that I am using for the program, so modifying the code could result in running out of memory. You may want to copy fragments of the code into a new application that meets your need.

NOTE: I also have Makecode versions of each of these program snippets at https://shop.reachandteach.com/circuit-playground-express-sample-code

Supplies

Optional:

For your convenience, you can get all of these items complete and ready to use out of the box in Reach and Teach's RTPlayground2 Inventor's Kit.

Step 1: Wire Up the LCA710 to Build a Solid State Relay Board

If you already have an assembled LCA710 Solid State Relay Board, skip to the Using the LCA710 Solid State Relay Board section of this step.

The LCA710 Solid State Relay is a really useful chip that makes it easy to control any low power circuit that has a switch already designed into it. This is because the solid state relay can be used to replace the switch with a digitally controlled switch.

  1. Mount a 1K resistor on a small breadboard
  2. Mount the LCA710 chip (notch side up) so that Pin 1 of the LCA710 is on the same row as the bottom of the resistor.
  3. Adding colored dots with felt-point pens make the board easier to use. Red indicates +3.3V digitally controlled input, Black is ground, and the switch outputs are Green.
  4. Attach wires to each of these dots and you will be able to easily use alligator clips to connect up this board
  5. CONGRATULATIONS, your Solid State Relay board is complete!

USING THE LCA710 Solid State Relay Board

To use this Solid State Relay board with RTPlayground2 and the Circuit Playground Express, use alligator clips to wire the Digital Control Input of the Solid State Relay board to the A0 pad of the Circuit Playground Express. Connect Digital Ground of the Solid State Relay board to any GND pad of the Circuit Playground Express. Wire the Switch outputs (colored green) to the switch you are trying to replace.

WARNING: DO NOT USE THIS TO REPLACE A SWITCH IN A LINE POWERED (ELECTRICAL OUTLET POWERED) DEVICE. There are other safe ways to do this like the Controllable Four Outlet Power Relay Module from Adafruit which will also interface nicely with the RTPlayground2.

An aside: A mechanical relay uses an electromagnet to cause a switch to turn on and off. A solid state relay works in the same way except that it uses a LED and phototransistor to cause the switching to occur (often called an opto-isolator circuit). However, there is a difference between an opto-isolator and a solid state relay besides the fact that an opto-isolator is less expensive than a solid state relay. Opto-isolators will typically only switch a very small amount of current whereas a solid state relay has additional circuitry to switch a higher current and voltage and can work with both AC and DC devices.

Step 2: Add a Battery Pack to the Circuit Playground Express

Although you can power the Circuit Playground Express with a micro USB cable, you will probably want to power it with batteries. The easiest way to accomplish this is to solder the leads from a 3 AA cell battery holder and a JST-PH 2 pin - Female cable which can plug into the power input on the Circuit Playground Express. It is recommended that you cover these connections with shrink tubing. The battery holder has a built-in switch, so the Circuit Playground Express can easily be switched ON and OFF.

Step 3: Load the RTPlayground2 Circuit Python Code

NOTE: If you have the RTPlayground2 Invention Kit, your Circuit Playground Express is already pre-loaded with CircuitPython and the RTPlayground2 software. You can skip this step.

Before loading the RTPlayground2 code, you will need to first provision the Circuit Playground Express with CircuitPython. You can find detailed instructions on how to do this at: https://learn.adafruit.com/adafruit-circuit-playg... . You will also need to load the CircuitPython Libraries as described at: https://learn.adafruit.com/adafruit-circuit-playg...

You do not require all of the library modules to be loaded, only the following:

  • simpleio.mpy
  • neopixel.mpy
  • adafruit_motor (directory)

The code for RTPlayground2 can be found at: https://github.com/reachandteach1/rtplayground2

You will need to copy the following files to the Circuit Playground Express:

  • pgm.txt -- default program configured when the Circuit Playground Express is powered up or reset
  • boot.py -- makes it possible to update/write to the pgm.txt file
  • code.py -- the RTPlayground2.py code

Once everything is loaded, make sure the Circuit Playground Express switch is in the left hand position (towards A7), and click the Reset button and/or apply power to the Circuit Playground Express. Pgm 0 should be operating and the neopixel LEDs should be showing a slowly changing rainbow of color and the red LED should be slowly pulsing on and off.


CONGRATULATIONS! RTPlayground2 is successfully installed on your Circuit Playground Express.

Step 4: Selecting a Program Function

There are 5 program functions Pgm 0, 1, 2, 3, 4 that you can select. To do this, slide the switch to the right and briefly click the Reset button. You will see a green LED illuminate on the left side of the Circuit Playground Express and indicates the currently selected program function starting with Pgm 0 with the top left LED. Clicking button A will cycle each of 5 LEDs green allowing you to select a new program. Move the slide switch to the left and the selected program function will start. Whenever, you power up or click the Reset button on the Circuit Playground Express from this point forward, the selected program function will run. In the following steps, we will show a few sample projects using each of these program functions.

Just a quick review of the list of what these functions are:

  • Pgm 0: Automatically cycle a motor or any other circuit ON/OFF or turn a servo back and forth

  • Pgm 1: Use sound or any IR remote control to turn a motor or circuit ON/OFF or activate a servo

  • Pgm 2: Use light to control a motor, circuit, or servo

  • Pgm 3: Variable control a circuit or servo using an external potentiometer knob or other voltage source

  • Pgm 4: Turn a motor or circuit ON/OFF or activate servo using color coded cards (Green or Red)

Step 5: Using RTPlayground2 With a K'nex Servo

The Laser Target Game instructable on this channel is an easy way to build a servo operated K'nex automata. Just follow the instructions for this instructable omitting step 5. Hopefully this construction can inspire other project ideas!

On the Circuit Playground Express, connect 3.3V to the red lead of the servo, Gnd to the brown lead of the servo, and A2 to the yellow lead of the servo.

Select Pgm:0

The Iron Man automata should stretch and lower its legs and arms repeatedly. Button B on the Circuit Playground Express can be clicked to adjust the rate at which this happens.

Select Pgm:1

The Iron Man automata can be activated with a loud sound (like clapping your hands) or pressing a button on an IR remote control while it is pointing at the Circuit Playground Express. Button B can be used to set how long the Iron Man automata is activated.

Select Pgm:2

The Iron Man automata will now stretch its legs and arms whenever a light is pointing at the light sensor on the Circuit Playground Express. Turning off the light will cause the automata to lower its arms and legs.

Select Pgm:3

You will need a potentiometer for this experiment. Connect the Circuit Playground Express's Gnd to one end of a potentiometer, 3.3V to the other end of the potentiometer, and A1 to the middle connector on the potentiometer. If you have a Tedco Tronex 288+, you will be connecting to pins 16, 17, and 18 on the Tronex board. Slowly turning the potentiometer's knob back and forth will cause the legs and arms to slowly stretch and relax. You've created a simple animatronic puppet! The Origami Fox Robot instructable is a really good example of how to do this.

Select Pgm:4

You will need two cards, one that is colored red and one that is colored green. One simple way to make these cards is to cut up green and red origami paper and mount each on cardboard cards. When the Circuit Playground Express is showing a ring of red LED lights, you can put a red colored card on top of the Circuit Playground Express to turn the LEDs green. You can likewise place a green card on top of the Circuit Playground Express while it is showing a ring of green LED lights to turn them red. Notice how the Iron Man automata responds to these two conditions.

Step 6: Using RTPlayground2 With a K'nex Motor Adapter

The K'nex Paper Wad Launcher instructable is an easy to construct project to use to experiment with controlling a K'nex motor with RTPlayground2. However, the motor needs to be modified before it is installed into this construction. Step 1, 2, and 3 of the Computer Control Your K'nex instructable will show how to do this. After making this modification, turn the K'nex motor switch ON (in either direction). The motor will not be moving. However, shorting both of the exposed tin foil tabs with an alligator clip should cause the batteries in the motor to be connected and the motor will start moving.

Connect the Circuit Playground Express with the Solid State Relay board as shown in Step 1 of this instructable. Also connect the Solid State Relay board switch outputs to the K'nex motor foil tabs as shown.

You will now be able to control this or most any motorized K'nex contraption.

Select Pgm:1

A loud sound (like clapping your hands) or pressing a button on an IR remote control pointed at the Circuit Playground Express should cause the the K'nex Paper Wad Launcher to operate for 3 seconds and then stop. The amount of time that the launcher operates can be changed by pressing Button B on the Circuit Playground Express. The time is settable to 3 secs, 5 secs, and 7 secs.

Select Pgm:2

The K'nex Paper Wad Launcher will operate as long as you are pointing a light at the light sensor on the Circuit Playground Express.

Select Pgm:4

Use red and green colored cards to turn the launcher ON and OFF.

Step 7: Using RTPlayground2 With Tedco's Tronex 288+ Kit

Because it is really easy to replace the switch in any Tronex 288+ or Snap Circuits project with RTPlayground2 loaded on a Circuit Playground Express, you immediately can take over 288 plus projects in the Tronex set and make them far cooler! One thing that's nice about the Tronex set is that it has a number of projects using its built-in sound chip that can produce a number of animal sounds.

As a really simple example, wire up Experiment 3: Rotor (Flying Fan) and LED on the Tronex 288+ set according to the instruction booklet. Then, connect up the Circuit Playground Express to the Solid State Relay as described in Step 1 of this instructable, wiring the switch outputs of the Solid State Relay board to 50 and 51 of the Tronex 288+.

Select Pgm:0
The motor should start and stop turning on a periodic basis. The red LED will also be blinking on and off. Button B on the Circuit Playground Express can be clicked to adjust the rate at which this happens with settings of 3 secs, 5 secs, and 7 secs.

Select Pgm:1

The motor and LED will be activated with a loud sound (like clapping your hands) or by pressing a button on an IR remote control while it is pointing at the Circuit Playground Express. Button B can be used to set the length of time that the motor and LED will be activated.

Select Pgm:2

Pointing a flashlight at the light sensor on the Circuit Playground Express turns on the motor and the LED. Turning off the flashlight turns the circuit off.

Select Pgm:3

You will need a potentiometer for this experiment. Connect the Circuit Playground Express's Gnd to one end of a potentiometer, 3.3V to the other end of the potentiometer, and A1 to the middle connector on the potentiometer. If you have a Tedco Tronex 288+, you will be connecting to pins 16, 17, and 18 on the Tronex board. Turn the knob to see at what point the circuit turns ON and OFF. (You may also want to think about what type of circuit you would need to control the speed of the motor and brightness of the LED.)

Select Pgm:4

You will need two cards, one that is colored red and one that is colored green. When the Circuit Playground Express is showing a ring of red LED lights, you can put a red colored card on top of the Circuit Playground Express to turn the LEDs green and the circuit ON. You can likewise place a green card on top of the Circuit Playground Express while it is showing a ring of green LED lights to turn them red and the circuit OFF. In this way, you can use colored cards to control a circuit's operation.

Step 8: Using RTPlayground2 for Halloween Fun

During the Halloween season, it's easy to find spooky animated devices that come to life whenever anyone approaches them. These devices most often also have a "Try Me" button that will trigger the device when you push the button. That's great for our purposes because all you have to do is connect up the Circuit Playground Express to the Solid State Relay as described in Step 1 of this instructable and wire the switch outputs of the Solid State Relay board to the "Try Me" switch on the device. Also check out the Remote Control Any Holiday Decoration instructable for a detailed example of this.

Select Pgm:1
The device will be triggered with a loud sound or by pressing a button on an IR remote control while it is pointing at the Circuit Playground Express.

Select Pgm:2

Pointing a flashlight at the light sensor on the Circuit Playground Express triggers the device.

Select Pgm:3

Combined with a Tronex set and your imagination, you can trigger the device when someone goes through a door or steps on a doormat, rings a doorbell, or a variety of other actions.

Step 9: Congratulations! (and More Ideas)

These were just a few examples of ways to use the RTPlayground2 just to get you started. Here's a list of other challenges for you...

  • Create a K'nex servo operated contraption where a marble see-saws back and forth
  • Create a K'nex servo operated contraption that feeds marbles to a marble run whenever triggered by light or sound or a trigger of your choice
  • Build a motorized K'nex creature or vehicle that moves when you press a button on your IR remote control
  • Using a Tronex 288+, can you create a device that barks like a dog when someone breaks into your room or house?
  • Using a Tronex 288+, can you create a device where a rooster crows when the sun rises? Extra points for creating a rooster puppet that moves when it crows.
  • Create a device that lights an LED when a plant needs to be watered
  • Build a beanbag toss game where Iron Man dances when you hit the target
  • Build a device that sounds an alarm when someone tries to steal the last cookie on a plate
  • The volume buttons on an iphone's headphone jack cable can be used as a remote control trigger for its built-in camera. Can you figure out how to use this feature to take a photo of the person trying to steal the last cookie on a plate?
  • Based on the Easy Audio Effects + Amp instructable, how could you modify a toy roller coaster model to add sound effects?

Thanks for viewing this Instructable. Please let me know if you end up building this and what sorts of things you have invented with it.