Generic I/O board for pedals, with bistable relay  [documentation]

Original effects with schematics, layouts and instructions, freely contributed by members or found in publications. Cannot be used for commercial purposes without the consent of the owners of the copyright.
User avatar
MoonWatcher
Diode Debunker
Information
Posts: 715
Joined: 28 Jul 2008, 12:27
Has thanked: 40 times
Been thanked: 52 times

Post by MoonWatcher »

sinner wrote:Thats the coolest contribution I've seen here in months
I could not agree more!

User avatar
coldcraft
Diode Debunker
Information
Posts: 725
Joined: 11 Jul 2009, 01:00
Has thanked: 38 times
Been thanked: 85 times

Post by coldcraft »

stevo83 wrote:Is there any particular reason why you guys are interested in a PIC based implementation?

Or is it just personal preference?

I am asking out of genuine curiosity, as Atmel stuff is becoming more and more popular (thanks to Arduino I guess) and I was looking to start experimenting with programming again (not done any for years).

Are there specific reason for choosing between the two platforms or is it just 'horses for courses'?
personal preference. I'm already using a system that has a 12F509 programmed by someone else, but I'm ready to roll my own as a drop in replacement.
Black Dynamite wrote:you need to shut the fuck up when grown folks is talkin.

User avatar
J0K3RX
Degoop Doctor
Information
Posts: 1058
Joined: 29 Jun 2011, 01:25
Location: US Florida
Has thanked: 316 times
Been thanked: 556 times

Post by J0K3RX »


User avatar
J0K3RX
Degoop Doctor
Information
Posts: 1058
Joined: 29 Jun 2011, 01:25
Location: US Florida
Has thanked: 316 times
Been thanked: 556 times

Post by J0K3RX »

Getting ready to try the ATtiny switch that Pruttelherrie was so kind to have posted.. Anybody else try it yet? I built my own ATtiny programmer adapter for my Arduino UNO board.. hope I don't have any issues with that. I have a couple others to test also and a couple using PIC12F683 and 12F509... I wrote the code for PIC so not getting my hopes up with those. Anybody else have any good PIC base switches?

User avatar
sinner
Old Solderhand
Information
Posts: 4709
Joined: 06 Nov 2008, 17:16
Location: ...no more
Has thanked: 1031 times
Been thanked: 909 times

Post by sinner »

If I may, I have two questions to OP

Is it doable to set the primetime function to activate another switching option (relay)? Could you point me how to update the code if so?

Another question. Can you recommend any good books or forums where I can gain AVR programing skills? I'm mainly interested into switching applications

Thanks again for this project. It drives me on since weeks

User avatar
Pruttelherrie
Solder Soldier
Information
Posts: 248
Joined: 18 Feb 2011, 19:35
Location: The low lands
Has thanked: 46 times
Been thanked: 96 times

Post by Pruttelherrie »

Hi Sinner,

No thanks, I'm glad I can give something back after taking so much from all the knowledge displayed here and elsewhere!

It's possible to add another relay, however there's not enough pins on the ATtiny to connect another latching relay in the straightforward way, because you need two pins for that and there's only one left. For a latching relay to switch you need to put a voltage across it for a short time, the one I used needs 5V and something like 10ms~15ms. The polarity of the voltage determines what way it will switch. So with two output pins you can switch it any way around by just pulling one of the two pins high.

There's a number of solutions to overcome this problem of free output pins, among them:
* use a different controller with more output pins (duh!) drawback: bigger footprint
* add more hardware, to simulate something like mictesters switching scheme, so only 1 pin per relay is needed (bigger footprint again, also tweaking of cap values etc)
* make some kind of 'charlieplexing' so you can switch two relays with 3 output pins (keep 1 relay effectively unpowered while switching the other, I'm too lazy right now to make a diagram but if you're really interested I'll draw one up for you) (drawback: complicated code, but should be doable)
* use normal relays (drawback: this will consume more power)
And there's probably more possibilities I can't think of right now

As for the code: all the lines where 'primetime' is mentioned :P You will need to toggle the outputs whenever the primetime variable is toggled.
There's more ways to activate a second relay, for example with the double-click, hinted at in the code as well.
What exactly are you thinking about switching with the primetime/doubleclick/whatever? What use cases did you come up with?

Then the programming: as soon as you understand the basics of C you're good to go, advanced topics (interrupts, saving power) can wait until you have your basic switching going. Arduino is often made fun of, but I find it a really handy way to get something/someone up and running fast. I don't find it particularly satisfying to get the fastest code or smallest code etc, I need it to work so I can get on with the huge backlog of other projects! :roll:
Keeping code simple and straightforward makes it maintainable and understandable for others, as well.

If you have more questions, keep 'em coming! Glad I can help!

Pruttel.

User avatar
sinner
Old Solderhand
Information
Posts: 4709
Joined: 06 Nov 2008, 17:16
Location: ...no more
Has thanked: 1031 times
Been thanked: 909 times

Post by sinner »

Thanks for your reply mate

It's actually interesting as Chris (Mictester) during my last phone chat with him suggested to make a fusion of his switching idea with AVR controllers.

I will Google charlieplexing. Never heard of it before...

What I actually trying to accomplish is doing buffered/truebypass switching the fancy way ;) call me lazy but I would hate to bend myself every time my klon clone screwing my fuzz tone. 3sec depress or double click seems to be nice alternative

The real drive behind my recent fascination of this is my ability to design amps with more than two fully controllable channels. This is why I'm looking for solid learning base

User avatar
J0K3RX
Degoop Doctor
Information
Posts: 1058
Joined: 29 Jun 2011, 01:25
Location: US Florida
Has thanked: 316 times
Been thanked: 556 times

Post by J0K3RX »

sinner wrote:Thanks for your reply mate

It's actually interesting as Chris (Mictester) during my last phone chat with him suggested to make a fusion of his switching idea with AVR controllers.

I will Google charlieplexing. Never heard of it before...

What I actually trying to accomplish is doing buffered/truebypass switching the fancy way ;) call me lazy but I would hate to bend myself every time my klon clone screwing my fuzz tone. 3sec depress or double click seems to be nice alternative

The real drive behind my recent fascination of this is my ability to design amps with more than two fully controllable channels. This is why I'm looking for solid learning base
If you don't mind using PIC look here.. 1 of 3 switch. It's for a PIC12F629 but could be used for other 12F's as well.
There is also the schem and code for a 16F628A in a 1 of 8 configuration.

Description from the webpage
The original purpose behind this circuit was to provide manual switching of three relays such that only one relay was on at any time. It was also a requirement that there was a specific overlap (or make-before-break) period. The code was then further developed to provide deadband (break-before-make) as well as overlap switching. The mode and timing delay are stored as parameters in the PICs EEPROM memory making editing of these straightforward without the need to reassemble the source code.

This circuit controls up to three outputs using a 'radio button' type switching control. When any one of the channel inputs is selected, the corresponding output is turned on and all other outputs are turned off.


Look at schematic #2
http://picprojects.org/projects/relayswitch/index.htm
Attachments
rsappschrlyB.jpg

User avatar
Pruttelherrie
Solder Soldier
Information
Posts: 248
Joined: 18 Feb 2011, 19:35
Location: The low lands
Has thanked: 46 times
Been thanked: 96 times

Post by Pruttelherrie »

sinner wrote:It's actually interesting as Chris (Mictester) during my last phone chat with him suggested to make a fusion of his switching idea with AVR controllers.
One pin can drive his switching scheme. The only problem I see, is that the AVR will not be able to 'see' what the status is of the relay.
I will Google charlieplexing. Never heard of it before...
I'm pretty sure you can drive 3 relays with 3 pins, like on the Wikipedia page the schematic with 3 lines/6 leds. Each relay is represented by 2 antiparallel leds.
What I actually trying to accomplish is doing buffered/truebypass switching the fancy way ;) call me lazy but I would hate to bend myself every time my klon clone screwing my fuzz tone. 3sec depress or double click seems to be nice alternative
Interesting! I've been thinking about designing a true-bypass delay *with tails*, even though I'm not overly sensitive to true-bypass :)
The real drive behind my recent fascination of this is my ability to design amps with more than two fully controllable channels. This is why I'm looking for solid learning base
In that case I wouldn't go for latching relays but for something like Jok3rX posted. It can easily be changed to work with an AVR too.

Other tricks to free up more ATtiny pins include using the /reset line or combining input/output but that might be tricky to combine with charlieplexing.

User avatar
coldcraft
Diode Debunker
Information
Posts: 725
Joined: 11 Jul 2009, 01:00
Has thanked: 38 times
Been thanked: 85 times

Post by coldcraft »

Pruttelherrie wrote:
sinner wrote:It's actually interesting as Chris (Mictester) during my last phone chat with him suggested to make a fusion of his switching idea with AVR controllers.
One pin can drive his switching scheme. The only problem I see, is that the AVR will not be able to 'see' what the status is of the relay.
this I have done and it works very well. I use 1 pin to drive a BJT switch to ground connected to mictestor's relay driver. if the unit loses power, it reverts to bypass.
Black Dynamite wrote:you need to shut the fuck up when grown folks is talkin.

User avatar
Jack Deville
Resistor Ronker
Information
Posts: 403
Joined: 02 Apr 2009, 06:21
Completed builds: too many. too many.
Location: Portland, OR
Has thanked: 1 time
Been thanked: 86 times
Contact:

Post by Jack Deville »

No lock-up prevention/recovery?
I'm a "professional."
Buy my products and make me rich.

www.jackdeville.com

User avatar
Jack Deville
Resistor Ronker
Information
Posts: 403
Joined: 02 Apr 2009, 06:21
Completed builds: too many. too many.
Location: Portland, OR
Has thanked: 1 time
Been thanked: 86 times
Contact:

Post by Jack Deville »

coldcraft wrote:
stevo83 wrote:Is there any particular reason why you guys are interested in a PIC based implementation?

Or is it just personal preference?

I am asking out of genuine curiosity, as Atmel stuff is becoming more and more popular (thanks to Arduino I guess) and I was looking to start experimenting with programming again (not done any for years).

Are there specific reason for choosing between the two platforms or is it just 'horses for courses'?
personal preference. I'm already using a system that has a 12F509 programmed by someone else, but I'm ready to roll my own as a drop in replacement.
I think I know the details on this one?
I'm a "professional."
Buy my products and make me rich.

www.jackdeville.com

User avatar
coldcraft
Diode Debunker
Information
Posts: 725
Joined: 11 Jul 2009, 01:00
Has thanked: 38 times
Been thanked: 85 times

Post by coldcraft »

Jack Deville wrote:
I think I know the details on this one?
why yes you do. My requirements have slowly outgrown the system, and i've found the time to start programming my own.

I've not found any evidence of lock-up problems yet.
Black Dynamite wrote:you need to shut the fuck up when grown folks is talkin.

User avatar
J0K3RX
Degoop Doctor
Information
Posts: 1058
Joined: 29 Jun 2011, 01:25
Location: US Florida
Has thanked: 316 times
Been thanked: 556 times

Post by J0K3RX »

Might wanna have a look over here, some cool stuff on pages 3 & 4...
https://www.diystompboxes.com/smfforum/ ... ic=96667.0

User avatar
chicago_mike
Tube Twister
Information
Posts: 1754
Joined: 03 Jul 2008, 04:38
Has thanked: 22 times
Been thanked: 316 times

Post by chicago_mike »

Another PIC student here :D

My brother just got an EE job at Microchip. Hopefully he can send me some samples. :mrgreen: :applause:
Skyline FX 2013

User avatar
Pruttelherrie
Solder Soldier
Information
Posts: 248
Joined: 18 Feb 2011, 19:35
Location: The low lands
Has thanked: 46 times
Been thanked: 96 times

Post by Pruttelherrie »

coldcraft wrote:
Jack Deville wrote:
I think I know the details on this one?
I've not found any evidence of lock-up problems yet.
Me neither, but if you wanted to make it more robust I think Jack is referring to using the watchdog timer/reset, and then check the MCUSR register upon startup to check if the internal state should be taken from EEPROM or from SRAM. And make sure the state variable is compiled as an un-initialized value, I haven't looked into that yet.

User avatar
sinner
Old Solderhand
Information
Posts: 4709
Joined: 06 Nov 2008, 17:16
Location: ...no more
Has thanked: 1031 times
Been thanked: 909 times

Post by sinner »

It will take me years to understand what are you taking about guys, and another few to start coding myself

I don't understand a word you saying - literally

That won't set me of to try, though

User avatar
Pruttelherrie
Solder Soldier
Information
Posts: 248
Joined: 18 Feb 2011, 19:35
Location: The low lands
Has thanked: 46 times
Been thanked: 96 times

Post by Pruttelherrie »

sinner wrote:It will take me years to understand what are you taking about guys, and another few to start coding myself

I don't understand a word you saying - literally

That won't set me of to try, though
The concept is not toooo complicated: AVRs (or microcontrollers in general) can lock up for a variety of reasons, such as spurious signals on the inputs, unstable supplies, bad code, etc. To reset the chip in such a case, you can use the watchdog: it is an independent part of the AVR, with its own clock. If you configure the AVR to use the watchdog, it will count up at a preset rate. You can configure the watchdog to either trigger an interrupt, or reset the controller, as soon as it reaches the end of the counter (overflow). Now if you reset the watchdog timer regularly to zero from within the main program, it will never trigger that interrupt or reset. But once the main program locks up, the watchdog counter will not be reset to zero and eventually trigger the reset of the chip. That part is the lock-up prevention.

Now for the recovery: to get back to a known state, the main program will need to know if it reset from a lock-up, or from a normal power-up. It can deduce this from the MCUSR register. Then it knows if it should power-up normally and set the state from the saved EEPROM value, or restore the state from the un-initialized state variable in SRAM. (Do I actually make sense in this last part?)

Implementation of the above probably has some details not touched upon, but I believe this is the core of it.

User avatar
gena_p1
Breadboard Brother
Information
Posts: 81
Joined: 25 Apr 2009, 21:47
Location: Russia
Has thanked: 23 times
Been thanked: 11 times

Post by gena_p1 »

ATtiny current is 20mA per pin, relay current may be 30mA, so we are close to absolute maximum ratings of MCU.

Latching relay could be driven with only 1 transistor with fixed state button (like Carling spst), or 1 pcs. 74hc(t)00 with non-fixed state botton, like in Boss stompboxes.
No micro controller needed, no software debounce, etc.

User avatar
coldcraft
Diode Debunker
Information
Posts: 725
Joined: 11 Jul 2009, 01:00
Has thanked: 38 times
Been thanked: 85 times

Post by coldcraft »

the microcontroller is capable of so much more though, and that's the point here. it can do momentary switching, a muting pulse, a remote control in, even a second switch channel for adding a boost or something else.
Black Dynamite wrote:you need to shut the fuck up when grown folks is talkin.

Post Reply