Difference between revisions of "Multi-Control"

From Wiki
Jump to: navigation, search
(Add Library)
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
 +
SunFounder Multi-Control is a multi-function controller based on the Atmel ATmega32U4. With a mini USB port, it can be connected to the PC or Raspberry Pi directly. <br>
 +
After powering, the PWR (power) LED keeps constant lighting. Press any key and the TX LED will blink, which indicates the key data has been sent. <br>
 +
The front view is as follows:<br>
  
[[File:l1.jpg]]<br>
+
[[File:Multi-1.png]]<br>
  
SunFounder Multi-Control is a multi-function controller based on the Atmel ATmega32U4. With a mini USB port, it can be connected to the PC or Raspberry Pi directly.<br>
+
A reset switch, an ICSP 6-pin header, a Mini USB port and a touch input control. Touch input control switch is to turn the touch input on/off, to avoid unintended touch. ICSP 6-pin header is to write bootload to the chip and a mini USB port to upload the control program.<br>
After powering, the PWR (power) LED keeps constant lighting. Press any key and the TX LED will blink, which indicates the key data has been sent.<br>
+
There are 6 silica gel buttons and a joystick to simulate a gamepad, a reset switch, and a mode toggle switch (for touch terminals) on the controller. Besides the buttons, there are 4 GND ports and another 10 analog touch input ports for simulating the midi devices .<br>
+
On the back of the board, there are 2 groups of pin headers including one group of GND, and the other corresponding to the input of the 10 keys. They are reserved for extending more control functions. <br>
+
There is an ICSP 6-pin header to write bootload to the chip and a mini USB port to upload the control program. <br>
+
'''<font color=red>Functions:</font>'''<br>
+
The SunFounder Multi-Control can simulate the gamepad, midi input device, and PC keyboard. <br>
+
In the gamepad mode, the operation is the same as using a general gamepad and quite suitable for the RetroPi games.<br>
+
In the midi mode, it is used with alligator clip cables. One clip at a cable end bites the GND hole on the board and one at the other to the user. More clips connect the holes to conductors and the user inputs midi signals by touching the conductor (s). The operation and principle are quite similar with the Fruitkey developed by SunFounder.<br>
+
In the keyboard mode, the joystick acts the same as the up, down, left, and right arrow keys on the keyboard. Each button maps with a key. By default, A to left Ctrl, B to left Alt, X to Z, Y to X, SELECT to Space, and START to Enter. You can self-define the key mapping by modifying the key value in the header file.<br>
+
Mapping between key IOs in the board and Arduino IOs:<br>
+
  
 +
[[File:Multi-2.png]]<br>
  
 +
There are 6 silica gel buttons and a joystick.<br>
  
 +
[[File:Multi-3.png]]<br>
 +
 +
Besides the buttons, there are 4 GND ports and another 10 analog touch input ports.<br>
 +
 +
[[File:Multi-4.png]]<br>
 +
 +
On the back of the board, there are 2 groups of pin headers including one group of GND, and the other corresponding to the input of the 10 keys. They are reserved for extending more control functions.<br>
 +
 +
[[File:Multi-5-5.png]]<br>
 +
 +
Check carefully, you can see the pin definition on touch input and pin headers are the same with buttons and the joystick, meaning they can realize the same functions. For example, we can connect the pins of Up, Down, Left, and Right of the touch input or pin headers to realize the same control of the 4 directions by the joystick.<br>
 +
==Functions==
 +
The SunFounder Multi-Control can simulate the gamepad, MIDI input device, and PC keyboard. <br>
 +
'''<font color="blue">Gamepad Mode</font>'''<br>
 +
The operation is the same as using a general gamepad and quite suitable for the Retropie games. <br>
 +
Both the buttons & joystick and touch input & pin header can be applied in this mode.<br>
 +
'''<font color="blue">MIDI Mode</font>'''<br>
 +
Only touch input can be used in this mode. You can check mark on each touch input of tones on the back of Multi-control board.<br>
 +
 +
[[File:Multi-6.png]]<br>
 +
 +
It is used with alligator clip cables. One clip at a cable end bites the GND hole on the board and one at the other to the user. More clips connect the holes to conductors and the user inputs midi signals by touching the conductor (s). The operation and principle are quite similar with the FruitKey developed by SunFounder. <br>
 +
'''<font color="blue">Keyboard Mode</font>'''<br>
 +
In this mode, we make Multi-control a keyboard, which can realize the same functions.
 +
Both the joystick and buttons and the touch input and pin headers can be applied in this mode.
 +
Multi-control equals to a keyboard with 10 keys. You can self-define the key mapping by modifying the key value in the header file (later we will show you how). By default, '''A''' is mapped to the '''left Ctrl''', '''B''' to '''left Alt''', '''X''' to '''Z''', '''Y''' to '''X''', '''SELECT''' to '''Space''', and '''START''' to '''Enter'''. The joystick acts the same as the up, down, left, and right arrow keys on the keyboard.<br>
  
 
==Features==
 
==Features==
Line 27: Line 48:
 
==Test==
 
==Test==
 
===Add Library ===
 
===Add Library ===
An Arduino library is needed when using the joystick. <br>
+
Before uploading the code, we need to download and add Three libraries [http://wiki.sunfounder.cc/images/0/01/Joystick_and_MIDIUSB.rar joystick and MIDIUSB] first. <br>
Open Arduino IDE, select Sketch->Include Library->Manage Libraries<br>
+
Open Arduino IDE, select '''Sketch->Include Library->Add .ZIP Library'''<br>
  
[[File:l2.png]]<br>
+
[[File:Multi-7.png]]<br>
  
Search for joystick in the pop-up window. And click Install to add the library.<br>
+
Select joystick.zip, and click Open.<br>
  
 +
[[File:Multi-8.png]]<br>
  
 +
Then Include MIDIUSB library in the same way.<br>
  
Or click Add .ZIP Library to load the zip file in the code package.<br>
 
 
===Upload the Code===
 
===Upload the Code===
There are three Arduino code folders in the code package download, including joystick, keyboard, and midi. When you upload a program to the Multi-Control, it can realize the specific function. <br>
+
There are three Arduino code folders in the code package download-[https://github.com/sunfounder/SunFounder_Multi_Control.git SunFounder_Multi_Control], including gamepad, keyboard, and midi. When you upload a program to the Multi-Control, it can realize the specific function. <br>
  
 +
[[File:l4.png]]<br>
  
 +
Here we take gamepad as an example. Take the following procedures. <br>
 +
Choose the board: '''Tools ->Board->Arduino Leonardo'''.<br>
  
Take the following procedures. <br>
+
[[File:Multi-9.png]]<br>
Choose the board: Tools ->Board->Arduino/Genuino Uno.<br>
+
 
+
 
+
 
+
Then select Tools ->Port and select the port you just checked on Device Manager.<br>
+
  
 +
Then select '''Tools ->Port''' and select the port you just checked on '''Device Manager'''.<br>
  
 +
[[File:Multi-10.png]]<br>
  
 
Click the Upload icon to upload the sketch to your board. <br>
 
Click the Upload icon to upload the sketch to your board. <br>
  
 
+
[[File:Multi-14.png]]<br>
  
 
Wait till it’s done.<br>
 
Wait till it’s done.<br>
 +
 
===Check the Device===
 
===Check the Device===
 +
After the code is uploaded, check whether the device is recognized by the computer. Click '''Control Panel -> Hardware and Sound -> Device and Printers'''. Different devices will be recognized for uploading different code.<br>
 +
For instance, if you upload multi-control-keyboard, it will be recognized as a Keyboard.<br>
  
 +
[[File:Multi-11.png]]<br>
  
 +
If you upload multi-control-midi, it will be recognized as an Arduino Leonardo device.<br>
  
There is a new game controller for Arduino Leonardo under the Devices, which indicates the simulated joystick of Multi-Control has been connected to the computer. Right click on it, on the pop-up menu click Set game controller->Property. Then push the stick or press any key to see the test result. <br>
+
[[File:Multi-12.png]]<br>
  
 +
If you upload multi-control-gamepad, it will be recognized as a gamepad.<br>
  
 +
[[File:Multi-13.png]]<br>
  
===Joystick===
+
Here we can configure the gamepad: right click on it, on the pop-up menu click '''Game controller settings -> Properties'''. Then push the stick or press any key to see the test result.  <br>
In the joystick mode:<br>
+
  
 +
[[File:l9.png]][[File:l10.png]]<br>
 +
[[File:l11.png]]<br>
  
 +
===Gamepad Mode===
  
After uploading the code of joystick to the board, connect Multi-Control to Raspberry Pi with a USB cable. <br>
+
[[File:Multi-15.png.jpg]]<br>
===Keyboard===
+
In the keyboard mode:<br>
+
  
 +
'''Preparations'''<br>
 +
In Gamepad Mode, a Raspberry Pi will be used with the Multi-Control to make a gamepad for RetroPie games. Besides an SD card for Raspberry Pi and a power adapter, you still need to prepare the following accessories:<br>
 +
1 x Multi-Control<br>
 +
1 x Mini USB Cable<br>
 +
1 x Raspberry Pi<br>
 +
1 x HDMI display with a cable<br>
 +
'''Procedures'''<br>
 +
1. Upload the code multi-control-gamepad to the Multi-Control<br>
 +
2. Download and install the '''image of RetropPie''' to the SD card. For more details, please click: https://retropie.org.uk/docs/First-Installation/<br>
 +
3. Connect the Raspberry Pi to Multi-Control with the Mini USB cable, power the RPi and the display, and then you can start playing games!<br>
 +
4. You can also use touch input or pin headers on the board’s back to make it<br>
  
 +
===Keyboard Mode===
 +
In Keyboard Mode, the Multi-Control will be used as keyboard with the four positions of joystick and the buttons mapping to different keys. The key value can be modified in code.<br>
  
You can play many games by using just a few buttons, Multi-Control with key mapping is enough for it. Similarly, upload the code of keyboard to multi-control. Then connect it to the computer via USB and it can then be used as a keyboard for simple games.<br>
+
[[File:Multi-16.png.jpg]]<br>
===Modify the Key Mapping of the Board===
+
To change the key mapping of the Multi-Control, you can modify the header file keymap.h in the keyboard folder.<br>
+
  
 +
'''Preparations'''<br>
 +
1 x Multi-Control Board<br>
 +
1 x Mini USB Cable<br>
 +
1 x Computer<br>
 +
Some plastic clay<br>
 +
Several Alligator Clip Cables<br>
 +
'''Procedures'''<br>
 +
1. Upload multi-control-keyboard to Multi-control<br>
 +
2. Now you can start to play: pull the joystick, you can play many games by using just a few buttons. Multi-Control with key mapping is enough for it. <br>
 +
3. You can also use touch input or pin headers on the board’s back as well.<br>
  
 +
'''Modify the Key Mapping of the Board'''
 +
To change the key mapping of the Multi-Control, you can modify the header file keymap.h in the keyboard folder.<br>
  
===Midi===
+
[[File:l14.png]]<br>
  
 +
===MIDI Mode===
 +
In MIDI Mode, the Multi-Control will be used as the input media for all kinds of virtual instruments. You can simulate a piano with bananas, or other conductors as the inputs for various instruments.<br>
 +
<font color="red">Note:A MIDI player is needed here, and a software named '''VMPK''' (Virtual MIDI Piano Keyboard) for computers and mobile devices is recommended. You can also use other similar MIDI player apps.</font><br>
 +
'''Preparations'''<br>
 +
- 1 x Multi-Control<br>
 +
- 1 x Mini USB Cable<br>
 +
- Several Alligator Clip Cables<br>
 +
- Bananas<br>
 +
- 1 x PC<br>
 +
'''Procedures'''<br>
 +
1. Burn multi-control-midi code to Multi-control<br>
 +
2. Download <font color="red">'''VMPK''' (or other MIDI software)</font><br>
 +
3. Connect each touch input of Multi-Control with an alligator clip cable and a banana. The tones for every touch input are marked on the back of the board.<br>
  
 +
[[File:Multi-6.png]]<br>
  
Use the alligator clip cables to make a midi device. One clip at a cable end bites the GND hole on the board and one at the other to the user. More clips connect the holes to conductors and the user inputs midi signals by touching the conductor (s).<br>
+
<font color="red">Note: '''CONNECT''' your body and GND with an alligator clip cable.</font><br>
A midi player is needed here, and a software named VMPK for computers and mobile devices is recommended here. You can also use other similar midi player apps.<br>
+
4. Now, you can start you banana-piano show. Or find a partner to play with you, as long as you all have connected to GND of the Multi-control - that's why there are several GND holes on the board.<br>
===Change the Instruments under Midi ===
+
 
 +
'''Change the Instruments under Midi'''
 
You can change the instruments that midi simulates by modifying the midi.ino file. <br>
 
You can change the instruments that midi simulates by modifying the midi.ino file. <br>
  
 +
[[File:l16.png]]<br>
 +
 +
'''Modify the Musical Scale'''
  
 +
[[File:l17.png]]
  
===Modify the Musical Scale: ===
+
==Resource==
 +
[https://github.com/sunfounder/SunFounder_Multi_Control.git SunFounder_Multi_Control]

Latest revision as of 03:40, 7 June 2017

Introduction

SunFounder Multi-Control is a multi-function controller based on the Atmel ATmega32U4. With a mini USB port, it can be connected to the PC or Raspberry Pi directly.
After powering, the PWR (power) LED keeps constant lighting. Press any key and the TX LED will blink, which indicates the key data has been sent.
The front view is as follows:

Multi-1.png

A reset switch, an ICSP 6-pin header, a Mini USB port and a touch input control. Touch input control switch is to turn the touch input on/off, to avoid unintended touch. ICSP 6-pin header is to write bootload to the chip and a mini USB port to upload the control program.

Multi-2.png

There are 6 silica gel buttons and a joystick.

Multi-3.png

Besides the buttons, there are 4 GND ports and another 10 analog touch input ports.

Multi-4.png

On the back of the board, there are 2 groups of pin headers including one group of GND, and the other corresponding to the input of the 10 keys. They are reserved for extending more control functions.

Multi-5-5.png

Check carefully, you can see the pin definition on touch input and pin headers are the same with buttons and the joystick, meaning they can realize the same functions. For example, we can connect the pins of Up, Down, Left, and Right of the touch input or pin headers to realize the same control of the 4 directions by the joystick.

Functions

The SunFounder Multi-Control can simulate the gamepad, MIDI input device, and PC keyboard.
Gamepad Mode
The operation is the same as using a general gamepad and quite suitable for the Retropie games.
Both the buttons & joystick and touch input & pin header can be applied in this mode.
MIDI Mode
Only touch input can be used in this mode. You can check mark on each touch input of tones on the back of Multi-control board.

Multi-6.png

It is used with alligator clip cables. One clip at a cable end bites the GND hole on the board and one at the other to the user. More clips connect the holes to conductors and the user inputs midi signals by touching the conductor (s). The operation and principle are quite similar with the FruitKey developed by SunFounder.
Keyboard Mode
In this mode, we make Multi-control a keyboard, which can realize the same functions. Both the joystick and buttons and the touch input and pin headers can be applied in this mode. Multi-control equals to a keyboard with 10 keys. You can self-define the key mapping by modifying the key value in the header file (later we will show you how). By default, A is mapped to the left Ctrl, B to left Alt, X to Z, Y to X, SELECT to Space, and START to Enter. The joystick acts the same as the up, down, left, and right arrow keys on the keyboard.

Features

1.Small size: 120 x 50 x 32 mm
2.Fixing Hole: M3, sizing 113mm (H) x 31mm (V)
3.Communication with the master via mini USB
4.Supply Voltage: 5V (powered by USB)
5.With 6 buttons, 1 joystick, 10 touch contacts, 10 pin headers (6 share the same IO ports with the buttons)
6.Contains 1 ICSP pin header, 1 Reset switch, and 1 Mode toggle switch.

Test

Add Library

Before uploading the code, we need to download and add Three libraries joystick and MIDIUSB first.
Open Arduino IDE, select Sketch->Include Library->Add .ZIP Library

Multi-7.png

Select joystick.zip, and click Open.

Multi-8.png

Then Include MIDIUSB library in the same way.

Upload the Code

There are three Arduino code folders in the code package download-SunFounder_Multi_Control, including gamepad, keyboard, and midi. When you upload a program to the Multi-Control, it can realize the specific function.

L4.png

Here we take gamepad as an example. Take the following procedures.
Choose the board: Tools ->Board->Arduino Leonardo.

Multi-9.png

Then select Tools ->Port and select the port you just checked on Device Manager.

Multi-10.png

Click the Upload icon to upload the sketch to your board.

Multi-14.png

Wait till it’s done.

Check the Device

After the code is uploaded, check whether the device is recognized by the computer. Click Control Panel -> Hardware and Sound -> Device and Printers. Different devices will be recognized for uploading different code.
For instance, if you upload multi-control-keyboard, it will be recognized as a Keyboard.

Multi-11.png

If you upload multi-control-midi, it will be recognized as an Arduino Leonardo device.

Multi-12.png

If you upload multi-control-gamepad, it will be recognized as a gamepad.

Multi-13.png

Here we can configure the gamepad: right click on it, on the pop-up menu click Game controller settings -> Properties. Then push the stick or press any key to see the test result.

L9.pngL10.png
L11.png

Gamepad Mode

Multi-15.png.jpg

Preparations
In Gamepad Mode, a Raspberry Pi will be used with the Multi-Control to make a gamepad for RetroPie games. Besides an SD card for Raspberry Pi and a power adapter, you still need to prepare the following accessories:
1 x Multi-Control
1 x Mini USB Cable
1 x Raspberry Pi
1 x HDMI display with a cable
Procedures
1. Upload the code multi-control-gamepad to the Multi-Control
2. Download and install the image of RetropPie to the SD card. For more details, please click: https://retropie.org.uk/docs/First-Installation/
3. Connect the Raspberry Pi to Multi-Control with the Mini USB cable, power the RPi and the display, and then you can start playing games!
4. You can also use touch input or pin headers on the board’s back to make it

Keyboard Mode

In Keyboard Mode, the Multi-Control will be used as keyboard with the four positions of joystick and the buttons mapping to different keys. The key value can be modified in code.

Multi-16.png.jpg

Preparations
1 x Multi-Control Board
1 x Mini USB Cable
1 x Computer
Some plastic clay
Several Alligator Clip Cables
Procedures
1. Upload multi-control-keyboard to Multi-control
2. Now you can start to play: pull the joystick, you can play many games by using just a few buttons. Multi-Control with key mapping is enough for it.
3. You can also use touch input or pin headers on the board’s back as well.

Modify the Key Mapping of the Board To change the key mapping of the Multi-Control, you can modify the header file keymap.h in the keyboard folder.

L14.png

MIDI Mode

In MIDI Mode, the Multi-Control will be used as the input media for all kinds of virtual instruments. You can simulate a piano with bananas, or other conductors as the inputs for various instruments.
Note:A MIDI player is needed here, and a software named VMPK (Virtual MIDI Piano Keyboard) for computers and mobile devices is recommended. You can also use other similar MIDI player apps.
Preparations
- 1 x Multi-Control
- 1 x Mini USB Cable
- Several Alligator Clip Cables
- Bananas
- 1 x PC
Procedures
1. Burn multi-control-midi code to Multi-control
2. Download VMPK (or other MIDI software)
3. Connect each touch input of Multi-Control with an alligator clip cable and a banana. The tones for every touch input are marked on the back of the board.

Multi-6.png

Note: CONNECT your body and GND with an alligator clip cable.
4. Now, you can start you banana-piano show. Or find a partner to play with you, as long as you all have connected to GND of the Multi-control - that's why there are several GND holes on the board.

Change the Instruments under Midi You can change the instruments that midi simulates by modifying the midi.ino file.

L16.png

Modify the Musical Scale

L17.png

Resource

SunFounder_Multi_Control