0
\$\begingroup\$

I'm going to build a switching device for my guitar effect units. I want to integrate some simple form of memory, which should be able to store some on/off states, even when power is off. However, I still don't know much about electrical engineering, and I really don't know where to look for the right information. Thanks to google I came up with 3 possible solutions myself already: -Use latching relays. However, this is quite expensive, and I don't know how well the relay keeps its state when moved.

-Use EEPROM or something like that. However, since I'm still a beginner, I really don't understand how these things work and how I can control these things

-Use CPLD. Seems like the best solution. Only problem is that I need to buy some expensive cable to connect the chip to my computer.

Can you please give me some advice on how to do this? I really don't know what to look for!

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Are you sure you don't want to use toggle switches? \$\endgroup\$
    – endolith
    Jun 29, 2011 at 15:28

4 Answers 4

3
\$\begingroup\$

I'm trying to get an idea of what those on/off states may be. They shouldn't be mechanical switches; they maintain their state also when power is switched off. Unless you're afraid the may be toggled accidentally in transport. No memory can help you here: there's no electronic way to switch it back to the right state.
So the question is: what are those states and how are they currently controlled? They should be electrically or electronically controlled, or at least be able to control that way.

Let's look at the options you suggest:

  1. the latching relay looks simple, but control-wise you'll have the same problem as with a microcontroller solution.
  2. the EEPROM is the most logical choice to store settings, but it can't do anything on its own; it will need a microcontroller.
  3. the CPLD. I find this a strange one, especially since it's much more complex to interface a CPLD to an EEPROM than it is for a microcontroller, and you mention expressly that you're a beginner.

Suppose one of the states is a transistor's. Could be a transistor that switches a relay, or switches an sound effect in a circuit. In any case, it must be used as a switch. You would read the state into a microcontroller, which stores it into nonvolatile memory at power-down. When the device is powered-up again, the controller would read the state from the nonvolatile memory and set the transistor accordingly. The original signal which controlled the transistor would have to be cut, otherwise it would conflict with the microcontroller's signal. So the microcontroller would also have to monitor this signal continuously and switch the transistor accordingly.

edit
the transistor may control just anything, like a relay. Low level audio signals can be switched by compact reed relays, which usually require less power.
enter image description here
Or you could use integrated electronic switches like the 74HC4066 and you may even not need the transistor.

The program for the microcontroller is easy, basically just copy an input pin to a corresponding output pin, and save to EEPROM. For the former you could use a CPLD , but like I said writing to EEPROM and reading from it is much more involved for a CPLD than for a microcontroller.
There are some microcontrollers which have on-chip EEPROM, like Atmel AVR, but you could also use an external serial EEPROM.

\$\endgroup\$
7
  • \$\begingroup\$ @stevenvh Thank you very much for your answer! The switches are meant to include or exclude guitar effects from the circuits, and I'll probably use relays for that, since the sound-signal is AC. Anyway, I think I will try to use a microcontroller for this. Btw, is it correct that this microcontroller also has some storage memory? \$\endgroup\$
    – Tiddo
    Jun 29, 2011 at 8:58
  • \$\begingroup\$ @Tiddo - No. The way I look for this is 1)search the text for "EEPROM", and 2)look at the block diagram (page 12) and look there for a block "EEPROM". But reading a datasheet is an art you have to learn. \$\endgroup\$
    – stevenvh
    Jun 29, 2011 at 9:09
  • \$\begingroup\$ @Tiddo - for signal switching you can use integrated switches like CD4066 or reed relays. I'll include it in my answer. \$\endgroup\$
    – stevenvh
    Jun 29, 2011 at 9:14
  • \$\begingroup\$ @stevenvh but flash is also non-volatile memory is it? I know it doesn't have any EEPROM, but it does have flash. \$\endgroup\$
    – Tiddo
    Jun 29, 2011 at 9:23
  • \$\begingroup\$ @stevenvh by the way, the switches need to act as a double throw switch, but it seems to me that those integrated switches like the one you mentioned acts like single throw switches. Is that correct? \$\endgroup\$
    – Tiddo
    Jun 29, 2011 at 9:30
2
\$\begingroup\$

Personally I'd base the project around a PIC or similar device as the core logic of the circuit and have that store the data internally in its own EEPROM. Yes, it means learning to program and use the MC of your choice, and to invest the few dollarpounds in a programmer (mine cost £17 from Hong-Kong), but the benefits would be well worth it I think. It would make storing and recalling presets an absolute doddle.

\$\endgroup\$
1
\$\begingroup\$

Of the possibilities you mentioned (EEPROM and CPLD) you will need to use an EEPROM to provide non-volatile memory. (Non-volatile storage maintains its contents when unpowered.) An EEPROM or Flash memory chip could be an appropriate solution, a microcontroller with built-in non-volitile memeory could also be a possibility.

\$\endgroup\$
2
  • \$\begingroup\$ @B Pete according to wikipedia CPLD already has non-volatile memory build it, that's why I mentioned that one, and not for example FGPA \$\endgroup\$
    – Tiddo
    Jun 29, 2011 at 7:45
  • 1
    \$\begingroup\$ @Tiddo - CPLDs are programmable logic, like FPGA's. CPLDs have their configuration stored in nonvolatile memory, but you can't just change one bit of it on the fly; you have to reprogram the device. So it definitely doesn't work like an EEPROM. (FPGAs are different in that they're RAM based (faster), and that they boot their configuration from an external serial EEPROM/Flash at startup. For security reasons some FPGAs have their boot-Flash integrated in the package.) \$\endgroup\$
    – stevenvh
    Jun 29, 2011 at 8:00
1
\$\begingroup\$

Depending on how much non-volatile memory you need, if your "switching device" involves a microcontroller, they typically have some amount of EEPROM on-chip (typically 1k, 2k, 4k, 8k)...

\$\endgroup\$
4
  • \$\begingroup\$ It needs to store less than 20 on/off settings, so technically I only need 20 bits. Could you maybe provide some links about microcontrollers/EEPROM, since I don't have any experience with this at all. By the way, is a CPLD also a microcontroller or is this something completely different? \$\endgroup\$
    – Tiddo
    Jun 29, 2011 at 7:44
  • \$\begingroup\$ edit: 20 bits per pre-set, but still,1K should be enough. \$\endgroup\$
    – Tiddo
    Jun 29, 2011 at 7:51
  • \$\begingroup\$ @Tiddo - a CPLD is different from a microcontroller. It contains a collection of logic components and can thus replace a complex (hence the "C") system of logical gates and flipflops. The outputs depend on the current inputs and the state of the internal flipflops. Everything occurs simultaneously. A microcontroller, OTOH, can do the same thing, but always takes 1 step at a time, and thus does thing sequentially. \$\endgroup\$
    – stevenvh
    Jun 29, 2011 at 8:05
  • \$\begingroup\$ @Tiddo All the Atmel AVR line of microcontrollers (including the ATMega328, on which Arduino is based) have EEPROM. If you go the Arduino route, there's a library for interacting with the EEPROM (arduino.cc/en/Reference/EEPROM). If you are more "hardcore" and want to program directly in AVR-GCC, there's also a library for that (nongnu.org/avr-libc/user-manual/group__avr__eeprom.html)... \$\endgroup\$
    – vicatcu
    Jun 29, 2011 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.