TL;DR: Why do pins go low when the arduino is powered off and can i prevent this?
I am trying to replicate a project done by somebody else controlling an IKEA standing desk.
To my surprise my table doesn't work the same at all, but i figured out how it worked.
The table only has two controls, up and down. These buttons connect with 3 wires to the motor unit.
Two wires are 5V and one ground, once they are pulled down to ground the table rises or lowers.
So i spliced the wires going to the buttons and hooked them up to the Arduino for a simple test based of a few tutorials.
And voila it worked just like that, not bad for a first arduino project...
So i turn off the power to the Arduino and the table starts rising, so i assume when powered off all pins get pulled low. Is there anything i can do against that?
Also if anyone sees an glaring issues with my idea, please do let me know. It is my first project and would like to learn more.
Try using an opto coupler between the Arduino and the table. A high level output from the Arduino makes the opto conduct and the table moves.
Or You can use an npn transistor and the same logic.
The output pins have diodes to protect from overvoltage; from the pin to +5, and from the pin to Gnd.
Take away power, the output transistors turn off, and the output diodes bring the pin voltage down to ~0.5V above Gnd if power is applied to them. Which your table electronics apparently see as a low.
Optocoupler should address that. No current flow on the input side should result in no current flow on the output side.
Or a simple NPN transistor with 1K base resistor could do it, that is all the output of the optocoupler is.
Or worse case, a small relay can be used. No coil current = no contact closures.
They are good to know about, very useful in nasty environments etc.
However a little npn transistor, any small one, and a 1 kOhm base resistor is adekvat.
Railroader:
They are good to know about, very useful in nasty environments etc.
However a little npn transistor, any small one, and a 1 kOhm base resistor is adekvat.
Unfortunately I don't have any, however I did find these opto couplers on a broken samsung LED TV power board.
After reading on how opto couplers work and finding out they are basically a LED and a receiver, I do worry about how to wire it up.
The first tutorials using LED's all put resistors in front to no burn out the LED, i have tried looking up the data sheet and go from there. But i can't make heads or tails from it yet.
Edit: I believe they are LiteON 817B opto couplers.
Fine. I'm not shure if rhey are marked L1321?
Goggle that id and get the data sheet.
Calculate that the LED needs 2 volt and 5 mA is enough. 5 volt controller - 2 volt LED == 3 volt across the resistor. 680 Ohm redistor.
Note where cathode and anode is. Also note the output, where the collector and where the emitter is.
Railroader:
Good. I don't produce fireworks anymore. Is the desk levelling performing well as well?
The basic tests on a breadboard are working well. I'll have to order some prototype boards or something to put this all on and have it enclosed in something so i can attach it and the distance sensor to the bottom of the table. The original idea was only one data line that needed modifying (The lin bus reported the height, so no need for a distance sensor), which probably could have been soldered directly onto the arduino, Now there a quite a few more components.
Then i need to make an windows application to control the arduino.
Nice to read. Select a box, big enough for future expansion. Maybe You want to use RFID tags to make the board go to a certain hight depending on the person, the mood...... Joking!
Check the voltage levels used in that hight signaling. 5 volt is ok for 5 volt Arduinos.