Any way to use a Red LED on DAC pin?

@jonlorusso, with NO Photon on the adapter board and power applied, measure the voltages on ALL the pins (even if not used) and post the results here.

1 Like

I destroyed my adapter trying to desolder everything, but I happened to have another photon around. I tried that: same behavior (pinMode is required). I had a separate controller board. I also tried that. Same behavior. I then tried another microcontroller (an arduino). The pinMode invocation was not required in that case. [Apologies for the really terrible debugging method].

I donā€™t know enough about these two platforms or their differences to understand why this might be, but I can assure you that pinMode was not required with a photon just a few months ago when I was previously working on this project.

If you supply 5V to a photon via VIN, and drive an OUTPUT pin HIGH, is HIGH 5V as well, or 3.3V? Could this be the issue here? It would explain why the code/circuit works on an Arduino, but not the Photon. Would it also explain why it does work when pinMode is set to INPUT?

@jonlorusso, the Photon GPIO only outputs 3.3v but most (not all) pins can tolerate a 5v input. This is why I was asking for the schematic.

thanks! itā€™s good to know iā€™m at least thinking (slightly) clearly about it.

so i know I can use a low drop voltage regular to drop from 5v down to 3.3v, but is there any way to do the opposite?

@jonlorusso, understanding what your hardware is doing would help. If the logic on the board will only work at 5v, you will need to use level shifters for all digital signals. Nothing on your board suggested you needed that (though I only see the one side). What would be the purpose of the ā€œreverseā€ voltage regulator?

So, the board is actually a treadmill controller which outputs a 5v control signal. I would assume, though I havenā€™t tested it, that I would need to match this voltage for the full range of speeds.

That said, there is an optocoupler:

I wonder if it would be possible to provide the board with 3.3V but use the optocoupler to signal at 5V?

@jonlorusso, how is the board powered? Whatā€™s on the other side of the board?

Also, I noticed that there is a crystal (X1) for the processor. I assume this is left disconnected on your adapter board? Most of what I see can run at 3.3v (switches, LED) and the opto-coupler CAN be used do the level shifting.

how is the board powered? What's on the other side of the board?

The board is powered (5V) via the white connector in the lower right-hand side. The reverse side has quite a few surface mount resistors, capacitors and transistors.

Also, I noticed that there is a crystal (X1) for the processor. I assume this is left disconnected on your adapter board?

Correct.

I think with the way the board is laid out, I would either need to level shift directly where 5V comes in and out of the board via that connector, or figure something else out, perhaps using pull-up resistors on my output pins?

@jonlorusso, you may need to level shift between the Photon and the rest of the board. Knowing what pins are inputs and outputs, you could use octal buffers like the 74HCT244 (there are many other types available). These will do the level shifting and provide similar per-pin current capabilities. To your board, the Photon will appear like a 5v processor.

@peekay123 thanks for all your help with this. I was wondering if you could take a look at this and tell me if Iā€™m on the right track. Basically I decided to drop down to 3.3V for the entire board using a simple voltage divider, and then use an op-amp to amplify the 3.3V signal back up to 5v. This seemed easier than routing each input/output pin from the photon through a buffer (considering Iā€™m using just about every pin n on the photon).

@jonlorusso, the voltage divider may not supply enough current for the board. You are better off with an LDO regulator. As for the control signal amplifer, a non-inverting amplifier can never have a gain of less than 1. You may be better served with a simple voltage divider but without a schematic, it is difficult to make recommendations.

@peekay123 I calculated my gain as approximately 1.515. Eg. 3.3v * 1.515 = 5v That said, almost all of my understanding of op-amps comes from the youtube videos I watched two nights ago :grin: so I could surely be confused.

@jonlorusso, it wasnā€™t obvious which ā€œdirectionā€ the op-amp was driving. You will need to consider the current requirements for whatever CF5 is driving to see if the op-amp can handle it. If there are transistors on the backside of the board, they may be for driving the LEDs but again, you will need to make sure they will switch at 3.3v as expected.