News:

SMF for DIYStompboxes.com!

Main Menu

Another Arduino Thread

Started by petemoore, February 09, 2011, 09:08:54 AM

Previous topic - Next topic

petemoore

  I hope to recieve and soon make my first Arduino control, simultaneously or otherwise:
  Value adjustments to controls, signal routing tasks, perhaps even barberpole waveform and other output shapes.
  Using Sensing devices:
  Photo [no bounce/reliable switching], or anything else [RF, temp, humidity, I/O and analog threshold parameters, perhaps combined 'if so, then'...connected to some of the analog and digital inputs for arduino to decide what do do when with.
  And using Outputs to controlling devices of circuit and electromechanical types: Servo, motor, Voltage controlled..light or sound controlled.
  Similar to a cyber-twin, but using control inputs and control outputs of choice to function to...whatever a code-chip-monkey can program.
     
Convention creates following, following creates convention.

drk

I've got mine yesterday. I've been trying it out, still going through the tutorials. Lets see what I can do with it :)

petemoore

#2
   I hope the initial startups go easier for you than they did for me.
 Don't know for sure why Ardie decided to start comming with the Laptop.
   Worth the trouble in education already though.
  ...Make sure to pick the right load-rate and you may need another download here and there, I read many pages and had to make adjustments deep in control panel.
Convention creates following, following creates convention.

drk

Well, I actually had some trouble to make it work, because I use mainly linux, and there's some incompatibilities (as usual) with arduino. I managed to make it work but I end up choosing to work in windows instead (I got both on my pc).
On windows it works without any problem, so I'm sticking with it.

Until now, I've been familiarizing myself not just with the arduino but mostly with sensors and buttons (and how you can get the input and do something with it). But I'm thinking of starting a 'real' project - a metronome. Doesn't seem that hard (but you never know :p)

If I manage to do something useful I'll post here.

cpm

Quote from: drk on February 20, 2011, 01:11:46 PM
Well, I actually had some trouble to make it work, because I use mainly linux, and there's some incompatibilities (as usual) with arduino. I managed to make it work but I end up choosing to work in windows instead (I got both on my pc).
On windows it works without any problem, so I'm sticking with it.

Until now, I've been familiarizing myself not just with the arduino but mostly with sensors and buttons (and how you can get the input and do something with it). But I'm thinking of starting a 'real' project - a metronome. Doesn't seem that hard (but you never know :p)

If I manage to do something useful I'll post here.

I use it with linux fine

i dont remember if i had to do anything special. The IDE lets you choose the usb device ("/dev/ttyUSB0" or others... they appear when the USB board is connected). Probably change the permission at /dev/...usb... for your user...
Anyway, if i actually had to do any of that, i found it easily with a bit of google

Not as fine as for PICs, my programmer is USB but only seems to work in windows, so is Microchip's MPlab... I ended up setting a virtualbox for not going through the hassle...

for a metronome you may want to look up the timers in the Atmega chip. If i recall correctly, the timers are "hijacked" by the arduino framework, or at least not accesible by high level instructions. The framework has the milliseconds count attached to Timer0, and Timer1 & 2 to analogwrite  functions for pwm pins. You can reconfigure them writting directly to its registers, and use their interrupts for precise timming, but those functions attached to them will be disabled (millis counter, pwm, ...)
There are some libraries that implement that, if you search


petemoore

  I tried breakin' into microcontrollers before.
  It appeared from a distance to be a 30' high, impenetrable wall of unknown words that extended to the left and right as far as the eye could see.
  I imagined Power Supply board, various chip boards that'd require debugging and a totally new set of debugging requirements, magic blue smoke clouding my view of poofing investments.  A whole lot of consumption and very little outcome except the initial super hard whack a hack with reality type learns.
  Then the open source hard/software of the Arduino popped into view.
  Sensing, microcontrolling, reading values = analog output...doing all the tricks as well as a microcontroller can [ie does amazing tricks effortlessly]. 
  All well and good, but it's the peripherals and the interface that make the applications "enabling beyond analog".
  That is a lot of hardware, re-wiring, redesigning of circuits in some cases.
  A whole new 1rackmount or greater sized undertaking? First, the plan...
  Ok I can get barberpole LFO / phasing in 5 !...but how bad do I want it ?...not so much, the speed control has a photocell on it so the expanded analog function is cool enough to 'compete' with barberpole.
  Ok I can get state changes and hook up relays/CMOS to control routing ! !
  I can get those parameters to control lights or destroy the stage...big deal, there's no stages around here I'm all that interested in destroying, let alone dragging the destruction hardware and setting up all the wiring down there.
  Basically if I had an application that'd 'pay'...not to say there isn't one in the stompbox realm [obviously there are already numerous examples of Digital and digital controlled/analog efx].
  Here's the suggestion: start with goal of making flexible, easy to re-program [or...multi-route controllers in case one think-module needs time to mull things over, another can have the program ready-now].
  Then it can be applied to fluently perform various functions of a morphable platform.
  The suggestion is to use digital control chips in a similar manner to stompbox chip usage, one chip may be able to multi-task [such as leave the booster on when using other effects], other times it is easier to add another chip [ie you want TS sound sometimes and D+ sounds other times] than it is to figure out a way to make the TS become a D+ with all two [or more if modded] of the D+'s adjustable parameters.
  The master chip circuit-er could make D+/TS, but might find it easier and more flexible [in terms of user interface and switch-to-adjusted alternative sound] to simply build both efx., each having it's own features.
   For instance I noticed I might be able to power-code around the possible need for a second clock [UNO has a clock onboard], or simply add a clock, it seems often the easy route is fascilitated by hardware prices that make it easy to just ''cheat'' in stead of code-cheating, just throw more hardware at it. This may or may not prove to have the benefits similar to that of "add an analog chip to get all D+ and TS features" mentioned did.
  I got a 'well wrappered' microcontroller to USB with the computer last week, I see the cost of the added chip and it's ability to be programmed and have additional feature/functions which are quickly accessible etc. as a possible 'add hardware' problem, as always, and since I'm new now, we will know more about it after. After some more is known about it !
  Anyway that's the way it's looking...no problem to imagine getting anything I want in terms of controlling analog audio circuits: Routing, adjusting, re-routing, multiple-adjustment of various parameters, switching, LFO's all that...just not in the signal path [necessarily]. Easy to imagine, a bit more work to set up though.
  I set some things up:
  Servo-motor controls [to expidite testing of analog and memory reads] imagining virtual potentiometer would be easier/cheaper/much more elegant. Simple codes could be made more complicated and memory/pot location type programs could be applied, etc. cybertwin type deal.
  Buncha sensors, had no problems sensing, supersensative to all forms of input I tried.
  I set up a light theremin.
  The O-Scope hack apparently extends up to 5khz, I wanted to O-Scope so I can't say how useful/good this'd be. 
  I have LED's that Ardie seems able to make do some of the easy to do and makes the hard to do analog LED tricks easy. I had Barberpole \\\ and /// LFO waveforms, no speed control [yet], and ramping is all +x per time unit, say +5 per 15ms, so flat ramps are N/P, curved ramps would require math I guess [analog does curvy 'naturally'].
  Boils down to new set of stuff, a fresh hardware/software platform.
  Wiring wires to my various other analog effects, finding a place to fit 'add on'...just doesn't seem the right scenario for a digital application approach to analog circuit controls.
  It'd require a fresh platform, I would probably pull my D+, and fit the Chorus etc. just like last time I made a pedalboard or filled a rack unit, but the digital would be interfaced more elegantly if not hacked in-and-on-to [basically would end up 'all over] an existing multi-pedal platform as an addendum.
  I'm sure any one of these micro-platforms can be built up or chosen as mainframe for master code-worker to do whatever it is a microcontroller can do.
  I chose the Arduino because the platform is RTGo with the peripherals on board, PS and USB taking care of com/power needs, open source software, mass produced boards that are easy fits, and have the advantages that mass production offers.
  It just seemed quite approachable, accessible, powerful, and with a much friendlier interface than what my reads had created as far as preconcieved notions about microcons. I did say new to being new to this since last week...
Convention creates following, following creates convention.

drk

In my case, the IDE didn't allowed to choose the usb device, because it was expecting another name ( /dev/ttyUSB__, but what appeared was /dev/ttyACM0), I fixed it with a symlink, which it worked.. sometimes. Occasionally the upload would hang and not work at all, so I just decided to go to windows. I'm using the arduino uno, maybe this problem happens only to this one?

Thanks for the tips, I've been trying the metronome with the tone() and delay() functions, and it does work like a metronome but the timing isn't accurate (with the bpm that are set) and also increasing/decreasing the tempo through some buttons didn't work very well, because of the delay() function, the program would only read inputs from some time to time... I found some libraries and I'm going to see if it works better with those.

petemoore, why the dashed text? Really hard to read that way :)
But seems like you've been busy. Its a bit hard in the beginning because there's so many stuff you don't know about but hey... if you don't try it will never get any better :p

cpm

built-in tone and delay functions are "busy" time delays. this means that when its doing tone the processor is inside a loop doing nothing else, same goes for delay, 250ms delay and 10ms tone is a total 260ms period... if you read analog inputs in between delays, the reads are done after 260ms too (not useful to sense a button push, or a soft response from a pot). the code executed between delays (analog read, calculation etc, will add to the time drift as they are not accounted in the timeline, its small but can turn into a noticeable problem when your time "quantums" are small enough)
Accurate timing and "multitasking" is quite complex to perfect. Its doable in the arduino but you have  to lay well your program, interlacing tasks, state logic, etc... and even resort to register hacking to regain some interrupts for precise timing


drk

Yes, I realized that about the delay(), but the tone() is also like that? Do I have to subtract the time spent on the tone() from the period of the metronome?

I found a library that deals with the repetition and there's no longer the problem with the delay() function. Haven't checked if the tempo is accordingly though (but probably not).
It seems I picked up something that isn't exactly that easy as I thought ehe :)

petemoore

  We're sorry about the strike throughs, I noticed that just now  ???
  Sometimes I'll copy into the mouse a long excursion post in case my time runs out ?
   Multiple boards is a way to put off becoming a master code monkey too early.
  That said it kind of looks like if multiple clockworks are to be precision [or even at all] either crafty setup/programming or...multiple boards.
  I've figured the hardware averages pretty good compared to the boards, and the boards compare pretty good compared to their cost Vs. capabilities...ie I have other uses for more Microprocessing already, for the applications, changing from multiple processors to one 'masterplanned program on a smaller board won't require any hardware alterations, so...my Mprocessing boards, should they become outclassed by future programs or board say with two clocks on it, they can easily be pulled and put to some other purpose, If you haven't wandered around in the adafruit and other sites that support Arduino, it's worth a look.
  Hush little duino don't you cry, soon you'll have another thing to try.
  Just having the Arduino has lit many ways to do things the Arduino could do, easier and sometimes, even much more simply, and without arduino...
Convention creates following, following creates convention.

drk

After a long struggle, I finally managed to get the LCD working. I was starting to doubt my capabilities... ehe  :D

I'll try to add the LCD to the metronome I'm working on, lets see if I work a bit faster now :)