Author Topic: Luna Mod  (Read 5522 times)

jhitesma

  • Newbie
  • *
  • Posts: 7
Luna Mod
« on: February 02, 2013, 02:45:59 pm »
My digi's came Friday - pretty hyped these are the first physical rewards I've gotten from any kickstarter :)


So debating what to do with them first I thought a quick easy project would be to make a "Luna Mod" looper for my 2 year old to play with.  It was originally designed around a picaxe and published in Make magazine but there are a couple arduino versions floating around:  http://www.instructables.com/id/Arduino-compatible-Luna-Mod-Looper/


Couldn't wait for my daughter to take her nap today so I could wire up a quick test:




Fullsize and other images: http://www.dunephotos.com/Electronics/Digispark/27834462_5fMHJL#!i=2347694794&k=5gD8FWz&lb=1&s=O


The circuit is pretty simple as per the instructible - just 2 pots (I grabbed some 10k linear) a pushbutton, and a way to get audio out (I just wired in an audio jack I'm running to a small battery powered amp.)  I added a USB cable for power and mounted it all on a piece of cardboard to test it out while paint drys on a nice tin I had laying around.


I'm not sure I got the pin assignments figured out correctly though.


I put the LED on Pin0 since I believe that's the on board LED - right? 
I put the speaker on P1
I attached the two pots to P4 and P5


Only the button and the pot on P5 seem to be doing anything.  The LED comes on but doesn't pulse.  I'm using the code straight from that instructible just with the pin assignments changed to match as I outlined above:


Code: [Select]


#define frequencyPot   5                              //frequency pot tied to pin 15 which is A1
#define tempoPot       4                              //tempo pot tied to pin 16 which is A2
#define buttonPin      2                              //programming button tied to pin 17 which is A3
#define ledPin         0                             //status led tied to pin 18 which is A4
#define speakerPin     1                             //speaker or output pin 19 whish is A5
                                                      //if you use a speaker it should be at least a 16 ohm speaker an should have a
                                                      //resistor, maybe 200ohm to 1K ohm, between the negative lead and ground.
                                                      //a potentiometer would be even better.


The wiring is really quick and dirty...but I've gone over it a few times and it all looks correct.  Anyone have any ideas am I ok on those pin assignments? 


Want to get this working well before I put the time into the nice box for it :D 
« Last Edit: February 03, 2013, 07:33:22 am by jhitesma »

jhitesma

  • Newbie
  • *
  • Posts: 7
Re: Luna Mod
« Reply #1 on: February 02, 2013, 02:56:53 pm »
Took a closer look and it appears the temo pot does affect the LED on the digispark - but even at it's "slowest" it was still too fast for me to recognize as binking at first.


There doesn't seem to be much variation from the frequency pot either.


Which leaves me wondering if the 10k linears weren't a good choice for this project...though the code sure reads like it shouldn't matter too much.  Wish I had more pots laying around to try...




jhitesma

  • Newbie
  • *
  • Posts: 7
Re: Luna Mod
« Reply #2 on: February 02, 2013, 03:02:50 pm »
Reread the model identification and realized mine is a Model A so I moved the speaker to P0 and the LED to P1. 


Now the LED is blinking at a sane rate ;)


But the temp pot still seems to have no affect and the frequency pot has only minimal affect. 

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Luna Mod
« Reply #3 on: February 02, 2013, 04:29:05 pm »
Since you are using analogRead with the pots you need to read them based on their analog port numbers not the pin numbers: http://digistump.com/wiki/digispark/tutorials/basics#analog_read


so it should be like this
Code: [Select]
#define frequencyPot   0                              //frequency pot tied on pin 5 which is analog 0


#define tempoPot       2                              //tempo pot tied to pin 4 which is analog 2


#define buttonPin      2                              //programming button tied to pin 2


#define ledPin         1                             //status led tied to pin 1 - built in LED on model A


#define speakerPin     0                             //speaker tied to pin 0



jhitesma

  • Newbie
  • *
  • Posts: 7
Re: Luna Mod
« Reply #4 on: February 02, 2013, 05:32:05 pm »
Ha!  I remembered reading something like that but couldn't remember where.  Works great now!


Will have to drill the case in the morning now though.


Thanks for the assistance!

jhitesma

  • Newbie
  • *
  • Posts: 7
Re: Luna Mod
« Reply #5 on: February 04, 2013, 11:01:22 am »
Went ahead and put it in a nice box since it was finally working:


http://www.youtube.com/watch?v=nIuKcqxu-WM


My daughter likes it when she plays with it...but as you can probably hear in the video not so much when I play with it :D


Pretty happy with this as a quick and dirty project for the 'spark!  We'll see how long the spark gets to live in there before I find another need for it ;)