# UART action tutorials

Subsequently, you will find tutorials of how to use the UART action.

# Remote control (Infrared)

The following tutorial explains, how to create a remote control for a TV by sending Infrared commands to the Open Source microcontroller Puck.js (opens new window), which supports emitting infrared light codes out of the box. The commands can be directly copied from the puckmote (opens new window) online remote control database (modified version for AsTeRICS Grid).

AG-puckmote

Fig. 1: Pasting infrared command into action field and try out of command.

  1. Get a Puck.js (opens new window) device (not Puck.js Lite) from the official shop (opens new window) or another distributor (opens new window).
  2. Follow the Puck.js Getting Started Guide (opens new window)
  3. Enable Bluetooth on your host device
  4. Turn on Editing mode
  5. Edit cell and got to Actions tab
  6. Select UART action
  7. Select Bluetooth as UART Type.
  8. Check if your device is contained in the puckmote database (opens new window).
  9. Test infrared command of choice, e.g. click on Power On or On.
  10. Copy the Puck.IR(....);\n command.
  11. Paste copied Puck.IR(....);\n command into the field Data.
  12. Click on OK to save the action.
  13. Turn off Editing mode

TIP

You can actually send any Javascript command supported by the Puck.js device, see Puck.js API Documentation (opens new window).

# Accessible toy

The following tutorial explains, how to create an accessible battery-powered toy (e.g. disco light, soap bubble machine or duplo train). The Puck.js (opens new window) device contains an on-board FET (transistor) and allows you to control medium current devices (up to 200mA) directly from Puck.js, without external components (see Puck.js+FET tutorial (opens new window)).

AG-puckjs-accessible-toy-FET-action-small

Fig 2: Demo of accessible disco light toy.

  1. Get a Puck.js (opens new window) device (not Puck.js Lite) from the official shop (opens new window) or another distributor (opens new window).
  2. Get a battery-powered toy. (The battery voltage must be below 20V).
  3. Create a battery-interruptor DIY (opens new window) (see Fig 3) and insert it at the flat side of the battery. For our example keep the wires open ended and don’t solder the audio socket onto them.
  4. Connect the negative pole of the battery N1 to the GND pin of the Puck.js device (see Fig. 4).
  5. Connect the positive pole of the battery P1to the FETof the Puck.js device (see Fig. 4).
  6. Turn on the on/off switch of the toy (if there is one).
  7. Now the toy is ready to be switched by the transistor of the Puck.js device.
  8. Open a grid and turn on Editing mode
  9. Edit cell and got to Actions tab
  10. Select UART action
  11. Select Bluetooth as UART Type.
  12. Enter FET.set();\n into the field Data.
  13. Click on OK to save the action.
  14. Turn off Editing mode

image

Fig 3: Battery interrupter

image

Fig 4: Wiring of battery interrupter and Puck.js

TIP

  • FET.set();\n: will turn the toy on.
  • FET.reset();\n: will turn the toy off.

TIP

You can also buy already adapted toys e.g. from enablingdevices (opens new window) or Ariadne Inklusivshop (opens new window). In such a case the Puck.js pins must be soldered to an audio jack plug.

WARNING

Electromagnetic devices (motors, solenoids, speakers, etc) let out big spikes of electricity when they are disconnected from power. While Puck.js’s FET provides a certain level of protection (350mA) for this Back-EMF, if you’re trying to power anything of any size with the FET pin we’d suggest you add your own diode across the pins of device that you’re powering to help to protect your Puck.js.

# FABI / FLipMouse

This tutorial explains, how to create a mouse movement using the button interface FABI or the mouth mouse FLipMouse. This currently only supports a wired serial connection to the device.

# Move mouse cursor to the right

  1. Connect the device to a desktop/laptop computer using a USB cable.
  2. Open a grid and turn on Editing mode
  3. Edit cell and got to Actions tab
  4. Select UART action
  5. Select Bluetooth as UART Type.
  6. Enter AT MX 100;\n into the field Data.
  7. Click on OK to save the action.
  8. Turn off Editing mode

TIP

You can send any FABI AT command (opens new window) or FLipMouse AT (opens new window) command (e.g. mouse click, keyboard input, slot change to remote control a Smartphone via Bluetooth HID, …) that is supported.