Pages: [1]   Go Down
Author Topic: Arduino Uno - as Microcontroller without computer possible?  (Read 926 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello folks,
i have an idea and i´m not to sure if this is do-able without an computer.
I would like to use  a arduino uno behaving pretty much like an quad-theremin. The ideas is to have an plattform with four marked areas. Each of the four areas is connected to a corresponding loudpseaker. when approaching with the hand to one of the area, there should be simple tone/sound comming out of the corresponding speaker. the closer the hand reaches the actual area, the louder the sound comming from the loudspeakers should be.

two reason why not using a computer.
first. for asthetic reason. everything should be as minimalistic as possible.
second. i heard, that when doing a project like that, all cables can/will act as big antennas with weird sound results.

the patches will be written from a friend of use.
it will probably written in max/msp. but suggestions for any other programming languages are very welcome.
because we are using this installation for an exhibition, which will take place only once, we want to avoid to buy an license (300US $ as far as i heard)

would that be possible without using an computer?
woud it be possible in another language rather than max/msp

any help is highly appreciated!

« Last Edit: May 04, 2012, 09:36:34 am by monoaural » Logged

0
Offline Offline
Faraday Member
**
Karma: 23
Posts: 3480
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
would that be possible without using an computer?

Yes.

Quote
woud it be possible in another language rather than max/msp

Yes - what is max/msp anyway? Arduino is usually programmed in C.
Logged

Check out my experiments http://blog.blinkenlight.net

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi udo.

thanks a lot for this quick answer.

could you please be little more specific what exactly i would need and how this will work?

http://de.wikipedia.org/wiki/Max/MSP

thanks in advance.

p.s. falls dir deutsch lieber ist, können wir auch ins deutsche forum übersiedeln.

beste grüße ais berlin
Logged

0
Offline Offline
Faraday Member
**
Karma: 23
Posts: 3480
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It appears to me that Max/Msp is intended for "visual programming". Since I have no clue of this abstraction I can give you no hints at all. I can only tell that Arduino can do it if you understand how to code in C. The way you are asking indicates that you might face a steep learning curve.
Logged

Check out my experiments http://blog.blinkenlight.net

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok.

appreciate your help.

thanks.
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you put any thought into the design aspect yet?  There are several ways to sense proximity (light, ultrasonic, capacitance) with tons of examples of each in the Arduino playground, in the forums, and generally online.

If you're new to the Arduino, look through some of the simple Playground sketches to get an idea how it all works.  www.ladyada.net has some good tutorials too.
Logged

Seattle, WA
Offline Offline
God Member
*****
Karma: 11
Posts: 673
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, there's this:  http://www.arduino.cc/playground/Interfacing/MaxMSP

The first thing to do is here search the web for "<whatever> Arduino".  Doing so for "Max/MSP Arduino" pulled up quite a list of hits.
Logged


0
Offline Offline
Faraday Member
**
Karma: 23
Posts: 3480
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The playground example will need a computer. He was asking about a setup without a computer. I suspect that it will be possible but only WITHOUT MaxMSP. Most probably MaxMSP would need to much resources for an Arduino.
Logged

Check out my experiments http://blog.blinkenlight.net

Offline Offline
Sr. Member
****
Karma: 11
Posts: 330
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you could use a 9v power adapter that fits in the black socket and plug it in the wall I do it all the time and it works perfectly because when I download the program to the arduino it saves it to the flash which is non-volatile meaning that it will be saved on the chip even after a power off and also here is some code I wrote a while ago that uses one wire for a therium like thing just one note: I have looked at what happens to a wire when you move your hand closer to a long wire and it looks like a square and when you move your hand closer the peak gets taller however my code just gets the median of a sample because I wrote this code before doing that and forgot to rewrite it.Also as you can tell by the program I did NOT write the median algorithm and also this contains alot of commented code but lacks of actual comments so sorry about that.
Code:
//1 wire insterment

/*
 *  This Quickselect routine is based on the algorithm described in
 *  "Numerical recipes in C", Second Edition,
 *  Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5
 *  This code by Nicolas Devillard - 1998. Public domain.
 */


#define ELEM_SWAP(a,b) { register unsigned int t=(a);(a)=(b);(b)=t; }

unsigned int quick_select(unsigned int arr[], int n)
{
    int low, high ;
    int median;
    int middle, ll, hh;

    low = 0 ; high = n-1 ; median = (low + high) / 2;
    for (;;) {
        if (high <= low) /* One element only */
            return arr[median] ;

        if (high == low + 1) {  /* Two elements only */
            if (arr[low] > arr[high])
                ELEM_SWAP(arr[low], arr[high]) ;
            return arr[median] ;
        }

    /* Find median of low, middle and high items; swap into position low */
    middle = (low + high) / 2;
    if (arr[middle] > arr[high])    ELEM_SWAP(arr[middle], arr[high]) ;
    if (arr[low] > arr[high])       ELEM_SWAP(arr[low], arr[high]) ;
    if (arr[middle] > arr[low])     ELEM_SWAP(arr[middle], arr[low]) ;

    /* Swap low item (now in position middle) into position (low+1) */
    ELEM_SWAP(arr[middle], arr[low+1]) ;

    /* Nibble from each end towards middle, swapping items when stuck */
    ll = low + 1;
    hh = high;
    for (;;) {
        do ll++; while (arr[low] > arr[ll]) ;
        do hh--; while (arr[hh]  > arr[low]) ;

        if (hh < ll)
        break;

        ELEM_SWAP(arr[ll], arr[hh]) ;
    }

    /* Swap middle item (in position low) back into correct position */
    ELEM_SWAP(arr[low], arr[hh]) ;

    /* Re-set active partition */
    if (hh <= median)
        low = ll;
        if (hh >= median)
        high = hh - 1;
    }
}

#undef ELEM_SWAP
#define speaker 3
#define wire 0
//#define outlier_low 250
//#define outlier_high 800
#define sample_size 32
unsigned int sample_data[sample_size];
  unsigned int loop_avg;
    unsigned int pitch_temp;
//#define uled
//uled=using led
#define led_green 8
#define led_red 7
void setup()
{
  #ifdef uled
  pinMode(led_green, OUTPUT);
  pinMode(led_red, OUTPUT);
  #endif
    Serial.begin(9600);
}

void loop()
{
  //get wire value
  unsigned int pitch;

  for (loop_avg=0;loop_avg <= sample_size ;loop_avg++)
  {
    #ifdef uled
   digitalWrite(led_green, LOW);   // sets the LED off
   digitalWrite(led_red, LOW);   // sets the LED off
   #endif
re_read2:
    pitch_temp=analogRead(wire);
    #ifdef outlier_low
    if (pitch_temp < outlier_low)
    {
      //Serial.println("pitch too low");
      #ifdef uled
      digitalWrite(led_green, HIGH);   // sets the LED on
      #endif
     goto re_read2;
    }
    #endif
    #ifdef outlier_high
    if (pitch_temp > outlier_high)
  {
       // Serial.println("pitch too high");
       #ifdef uled
       digitalWrite(led_red, HIGH);   // sets the LED on
       #endif
    goto re_read2;
  }
  #endif
   // pitch=pitch_temp;
   sample_data[loop_avg]=pitch_temp;
   // pitch/=2;
  }
  //now sort array
   pitch=quick_select(sample_data, sample_size);
  tone(speaker,pitch);
 
}
Logged

Pages: [1]   Go Up
Jump to: