Forum may be experiencing issues.

Main Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - mjg

Nice!  It's good to see it really coming along. 
Here's what worked for me...
Glad you got it working.  I breadboarded something very similar and that worked for me.  Only thing I left out is the opto chips.  If you have a common power supply for the Arduino and transistors, you don't need the opto chips.  But if you need that power isolated from each other, put them in. 

I think with your 100r resistors at 5v you will have 50mA going through the transistor, so check the data sheet to see what they can handle.  Or try 1k and see if that still works.

I've got with transistors as a buffer, rather than an inverting buffer.  Makes no real difference, as you just invert the logic on the Arduino pins to do what you want. 
Using a 555 would probably work, but all it's doing there is being a voltage controlled switch.  Which is the same as a transistor or mosfet really.  Not sure it will get you anything different to what you've already tried?
I'll see if I have time to breadboard something tomorrow for you.  Hopefully I've got a spare relay sitting around somewhere. 

I think what you need is two pins from the Arduino, connected through a transistor or mosfet each as a buffer, and then switch one pin high, other low.  Then reverse the high and low to switch back the other way. 

I think that diagram you've been looking at is a non latching relay?  That might be why it's not quite working. 
A 4010 or 4050 are pretty standard buffer chips, maybe start with one of those and see whether it does what you want. 

Have you been able to confirm the relay works by itself, by just hard wiring the voltage to it?  It should only need a quick touch of voltage to switch a latching relay.  No need to hold the voltage on for long.  Then you reverse the wires to switch back the other way, again, only for a brief moment. 
Another thing for you to research - look at non inverting buffer chips, and use one of those instead of your opto and transistors.  As pedal designers we tend to use transistors and opto chips as it's traditional, I guess... but there are usually better options for just signal control. 

You may find a hex buffer chip in a dip package that is cheaper and smaller than piles of opto and transistors.  That should fulfil your need of separating the Arduino from the relay. 
Another thing you could try, if you don't want to have the Arduino connected directly to the relay, is to have your opto chip controlling 2 transistors.  One will set 5v or ground, and the 2nd transistor will set the opposite.  Hook those up to your relay, and should be golden. 

Look for "transistor not gate" in your favourite search engine if you need pointers on how to do that?
Yep, if it's a latching relay, you need to be able to completely reverse the voltage.  Giving 5v and ground one way will switch the relay to position 1.  Giving ground and 5v opposite will switch it to position 2.  So your current schematic is definitely not doing that. 

I've had no issues with just switching using the Arduino directly.  You will need 2 pins on the Arduino to do this, as you will be reversing which one is  High and Low to flip the relay. 

Here is a build doc for one of my projects that used a relay, schematic on page 2, have a look around the attiny chip to see what it's doing.

And the code that goes with it:

"Latching"...that's the word I was failing to remember above. 😅

Check whether your relay is latching or not.

Also, if you are open to modifications, I have done plenty of Arduino and relay effects, and I don't think you need the opto or transistor at all.  I would normally just use a latching relay, and hook it up directly to 2 of the Arduino pins.  Put one high, the other low, for 100ms or so, to switch one way, and reverse the high / low for switching the other way.  That would require changing quite a bit of your board though. 
The Arduino code isn't going to make any difference here, so I'd concentrate on the other parts. 

You can even take the Arduino out of it, and just apply 5v or ground to the opto to simulate what will happen when the pin goes high or low.

I'm struggling to work out the layout around that relay.  If the transistor is on, then you get 5v at one pin and ground at the other.  If the transistor is off, you get 5v at one pin, and the other pin is floating.  That doesn't seem right? 

I'd probably use a multimeter to check how voltages are changing when you switch the opto, that might help isolate the issue, and you could also try just apply your 5v and ground to the relay pins to check it works. 

I can't remember if that relay is only on when voltage is applied, and off when no voltage, or if it is one where you reverse the voltage to switch the other way.  Might be worth checking what sort of relay you have, to make sure it will work with this schematic. 

Hope some of that is useful! 
There's probably an AI that could help you rewrite the novel about what you think about AI...

They've introduced AI as a 'helper' at my job, and so far I'm giving it 1 out of 5 on the review, because 0 isn't an option.  It's crap.  I spend more time having to think about what it's done, and identify the subtle or not so subtle ways it's wrong, than I would have spend just doing the work from scratch. 

That said, I see things about visual art that it produces, and it looks amazing what it can do in that space, which I understand comes down to training data and prompt writing skills.  It's very good at copying what it has seen before. 

For now I see it as a tool that can make a thing that is similar to things you train it about.  Intelligence isn't a word I'd use.  Machine Learning is closer to the mark. 

Huh, and now I've written a novel too. 😄
Ah yeah, I love the Bender theme. Very well done.
Open Discussion / Re: online PCB manufacturer
October 05, 2023, 08:42:58 PM
I've had good experiences with Elecrow. Haven't ordered anything for a while though.
"it just isn't what I'm looking for" ... I see what you did there. 😄

Nice colour scheme though, you've got the graphics, knobs and colour matched up really well.