Sida 10 av 11

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: tisdag 2016-06-28 23:14
av FlyingSheep
Hi bryggapa

Respect is the key word: meaning I will proceed with caution, having fully informed myself of the options and dangers. As I work in IT, I do things everyday that I have never done before, and did not understand only a few hours ago!

I agree that separation of the control electronics and the high voltage / current main board is vital, and the optocouplers discussed in this thread seem a good way to do so (and are a big reason for me talking to you guys).

The "servo to turn the knob" was a solution that I hit on early: e.g. http://rapidcitizen.com/arduino_remote_stereo_volume_control.html. While it may be a little bit Heath Robinson, it would be both totally non invasive and isolated from the dangerous stuff.

The various options I am considering, in no special order are:
a) Control the rotary encoder mechanically by a servo, allowing the power to be varied during mashing. Non invasive.

b) Emulate the rotary encoder, allowing the power to be varied during mashing. Invasive, and a not-proven solution, but should be possible.

c) Replace the current control pcb with the pcb from sister models with digital plus minus buttons, and hack with the solution in the german forum. Invasive, and the control pcb from sister model may not work with the microcontroller on my main board.

d) Buy a manual Hendi, and control it by turning the power on and off externally via SSR: This solution is non invasive, but only allows on / off of power, rather than plus / minus

e) Buy a manual Hendi, and control the power via custom control pcb (with Optocouplers), as developed in this thread. Invasive, but a proven solution (almost "off-the-shelf").

At the moment, e) seems the most elegant solution. d), which I initial rejected has a simplicity which is growing on me. a) is the wild-card solution.

skål

Chris

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: onsdag 2016-06-29 23:33
av FlyingSheep
HI all

Having spoken to a colleague who did electronics at university, at the moment hacking the control board of my existing induction hob via the rotary encoder is our favourite attack vector. The Hendi manual is a solid “Plan B”.

While I cannot identify exactly what rotary encoder is on the control board, it looks like it has 24 stops, giving a resolution of 96 per full turn of the knob. It has 3 contacts, ground, plus and minus.

ControllerFront.jpg
Controller Front View

RotaryControllerBack.jpg
Rotary Encoder Back

We think if I can “tap” into the plus and minus connections I can take both up to a “normally on” switch / socket combo, and then back to the controller board. This would mean that
a) when my external emulator is plugged into the socket, the rotary encoder is overriden.
b) when my external emulator is NOT plugged in, the rotary encoder is connected as normal and can be used to control power.
i.e. if my external controller / emulator goes haywire, I can just unplug and change to manual mode.
This is very close to the solution proposed at the start of this thread for the Hendi pot.

For the socket / switch combo, I think speakON connectors look good:. This example is “normally on”. All contacts on the male and female parts are hidden, eliminating the chance of a short-circuit as is possible with microphone plugs.

I did consider a switched XLR socket, until I realised that such sockets “normally off” only, which is the complete opposite of what we require!

To “tap” into the rotary encoder, I see 2 options:
1) tap directly into the “legs” of the encoder. (unsolder, bend up, connect “out channels” to legs, “return channels” to points where legs were previously soldered.
2) cut and tap into the 1st and 2nd wire from the right on the 9 way ribbon cable, which (if I have read the pcb traces correctly) are the connection from the encoder to the motherboard.

This leaves the sticky question of how to properly isolate the external controller from the internal control pcb. It has been wisely stressed several times in this thread that this best done with optocouplers. As my rotary encoder “hack” will require 2 wires going out, and 2 wires returning, am I correct in assuming that I will need 4 optocouplers?

Thanks for your time,

Chris

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: torsdag 2016-06-30 00:08
av bryggapa
Good job and I think you made the right choice!

You'll need two optocouplers, one for each line for emulating the encoder. If you want to read the encoder as well, you'll need two more.
The connector used to connect the control pcb to the power pcb is probably JST-XH here as well (but with more leads). I'd suggest trying to locate or build an 'extension cord' that you can put in between and splice into that. That way you won't need to make any permanent/destructive modifications to the original hardware.

Good luck, and please do report your progress!

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: torsdag 2016-06-30 20:46
av FlyingSheep
Yes, the ribbon cable is a JST XH-9a (this is printed on the pcb. under the cable). An extension ribbon is a good idea.

The proposed design concepts are:
  • Emulate the rotary encoder of my current digital hob using an Arduino / Raspberry PI.
  • Use a combined socket / “normally on” switch allow power control either via the emulator, or (unplugged) manually via the rotary encoder knob.
  • Only power level will be controlled externally. On / off control will be from the existing control pcb buttons.
  • When emulating, the A and B channels of the physical encoder will be cut-off, equivalent signal will be provided from the emulator pcb. However ground must be connected to both the emulator, and the existing control pcb (for display, power buttons etc).
  • Use speakON connectors (or similar) with concealed contacts to prevent accidental shorting of contacts to hob metal case.
  • Use JST XH-9 ribbon extension cable so that encoder A and B channels and ground wires can be cut and tapped without needing to modify the existing controller ribbon.
  • One way communication only: the emulator will “write” to the hob, but won’t read the output of the physical rotary controller (so far I have not found a use-case that requires reading the emulator).
  • Use optocouplers in the emulator to isolate the Arduino / Raspberry from the Hob electronics.
  • Schedule of emulator pcb: TBD. (possibly I can adapt one of the schedules already posted in this thread).

Slide1.jpg
Highlevel design

Slide2.jpg
Socket / Switch detail

Some concerns are:
  • While I like the simplicity of the “socket as a switch” for an immediate change from automated to manual power control, it means that the emulator pcb will have to be located external to hob case (unlike the AHM design in this thread). It also means that at least 3 wires (Encoder channels A and B, plus the common ground) will have to exit the case. If I want to internally mount the emulator pcb, and keep the ability to switch back to manual control, then I will probably need to use a Three Pole Double Throw (3PDT) switch.
  • If I change “on the fly” from automated control to manual control, how will the hob micro-controller behave? The physical rotary encoder channels will likely have different state to the emulated channels. I guess this would be interpreted as a state change, cause the power to be ramped up or down a notch. Probably not a major issue.
  • Correctly identifying the ground lead on the JST XH ribbon: I have guessed it is the first from the left on the picture above as it is the only lead connected to a pad without a trace going to something, or without another component soldered to it. The ground leg of the encoder is connected to a similar “island” pad, so I guess there is a second lower layer for the ground to which these islands are connected.

Thanks for any feedback

Chris

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: torsdag 2016-06-30 21:56
av bryggapa
However ground must be connected to both the emulator, and the existing control pcb (for display, power buttons etc).


I'm not sure if I'm following you here, but the only thing you can 'expose' are the inputs to the optocouplers. Connecting the grounds will defeat the whole purpose of optical isolation.
You need to break the A and B connection to the encoder and insert optocouplers there instead. The output side of the optocouplers may use 5v and/or ground from the ribbon cable. The inputs of the optocouplers are what you expose, they are isolated from the output and they will use 3.3 or 5v and ground from the Arduino or Raspberry.

You may have an Arduino, custom PCB or what ever inside the hob and it may use the internal 5v and gnd, but any signal routed out of the enclosure must be isolated.

If you are up for doing some Arduino coding, an internal Arduino (like the nano or pro mini), could be programmed to read the encoder AND an external signal and emulate the encoder down to the control PCB. No switches or anything.
The input could be anything then, like PWM, so you could just hook up a normal PID or thermostat or whatever floats your boat.
You could even put the control algorithm on the arduino and connect a sensor to it directly. But I might be getting ahead of myself. Just routing the A + B signals outside (via opto) for external control, should be a good start :)

Oh, and another thing. If you do use an internal PCB, you must make sure that it under no circumstances will be able to touch the metal of the enclosure.
The problem (as you might already know), is that the chassie is grounded (as in for personal safety) and while you will have 5V potential between 5v and ground on the ribboncable, that ground is floating and may have a lot more voltage compared to the chassie.
Better safe than sorry!

And a third thing...
With all probability, the rotary encoder will just feed a microcontroller, that will have high impedance inputs. So, you could probably get away with letting the physical rotary encoder use weak pullups and pulldowns (if it doesn't already), and use stronger pullups/pulldowns for the external emulator.

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: fredag 2016-07-01 11:18
av FlyingSheep
Thank you for your patience and sage advice.

You have pretty much hit the nail on the head with the issue of the ground. Getting the ground(s) right and safe troubles me the most:

I think that the problem is my design has 2 conflicting requirements.

a) be able to rapidly switch back from automated control to manual control. i.e. if something goes wrong (electronics, code etc) in the middle of a brew session I want be able to return the hob to an almost unmodified state.Hence the idea of the switch to remove all additional control circuitry from the signal path. *

b) Safety: properly isolate everything, exposing the bare minimum outside the hob case. Evidently this is best achieved by putting as much as possible inside the case.

On reflection b) is much more important than a), so if these requirements are truly conflicting I am willing to abandon a), especially in the face of requirement c) Keep It Simple! 8)

The way I understand the rotary encoder works, the a and b signals are relative to the common ground (of the hob control pcb). This implies to me that all three must be connected to the output side of the optocouplers (e.g. collector to A, emitter to hob ground). Clearly the hob ground must not be connected to the ground of the Arduino (which will be connected to the front side of the optocouplers, thus completely isolated). So in my initial design the isolation of the Arduino from the Hob takes place on an intermediate pcb with the 2 optocouplers etc in its own little case outside the hob.

I have never touched an Arduino or a Raspberry, but that does not worry me, I am an IT architect so that is much closer to my comfort zone, and there is abundant advice out there on the web.

While the idea of an internal Arduino has a certain neatness about it, I envisage that the control software will go through several evolutions, and thus need updating. This will be easier with an external Arduino.

Thanks for highlighting the issue of floating ground. I was vaguely aware of it, but don’t totally understand it yet - more internet research coming up!

The design evolves …..

Cheers

Chris

* maybe I have burnt fingers here: I had a BrauEule that had an issue with the temperature probe causing it to stop heating at 60c. However I was able to save the brew session by manually controlling the heating element.

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: fredag 2016-07-01 23:28
av bryggapa
If you want to be able to choose between manual and external control. A DPDT switch, would be the easiest way.
It would be used to select either the output A and B from the encoder or A and B from the output from the optocouplers.

It doesn't matter if you put stuff inside the case or outside, it is purely esthetics. You just need to make sure that the low voltage net inside, never can connect to another net (due to the potential difference).

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: söndag 2016-07-03 16:54
av FlyingSheep
Hi All

Thanks for all the ideas and advice.

Over the past few days I have done lots of work and thinking, but not much visible progress! My brain is bulging on all sides from all the research! 8)

I have ordered a Raspberry PI 3 + breadboard + T-Cobbler + various bits and bobs. The decision for a Raspberry (vs an Arduino) was somewhat arbitrary as there is a clear function overlap: both could have done the job. However If I want to do more than just control hob power, the PI offers more possibilities.

After reading many reviews of schematic / pcb design tools I decided that Fritzing was more suitable than Eagle for a beginner. By most accounts Eagle is a powerful tool, but has a step learning curve due to an antiquated user interface. I installed Fritzing and spent most of yesterday learning / fighting it to design my own controller circuit, taking AHM’s example schedule as a starting point.

I also stumbled across CircuitLab, a circuit simulator. While it is impressively easy to use, and should be ideal for calculating voltage and current at various points in a circuit, unfortunately it does not offer optocouplers!

@AHM, I have 2 simple questions (so far) to your schedule:
a) the 2 “step.down” resistors R2 and R3 are 100 ohms each. My schoolboy ohm’s law suggests to me that for a PC817 at 1.2 V we want to step down from 5V by 3.8 V, and that at 20 mA a 200 ohm resistor is required. Have I missed something?

b) The isocouplers (the load) are connected to the transistor emitters. i.e. emitter follower / common collector. What were the reasons you chose this layout instead of a common emitter (isocoupler on the collector)?

I must pour a pint to sooth my brain! Skål

Chris

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: måndag 2016-07-04 07:42
av bryggapa
Fritzing will probably work out for you, but I'd recommend KiCAD over Eagle if you want to step it up later on.

I don't want to step on AHm's toes here, so he can correct me if I'm wrong
a) You are right. What is important is to check the datasheet for the optocoupler you are using, to make sure you're driving it correctly.
b) I think you are right here also. The opto's should go on the collector side.

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: måndag 2016-07-04 21:03
av FlyingSheep
I suspect that for our application, both common collector and common emitter may work, but the behaviour will be different

http://www.allaboutcircuits.com/textbook/semiconductors/chpt-4/common-collector-amplifier/
http://www.allaboutcircuits.com/textbook/semiconductors/chpt-4/common-emitter-amplifier/

b.t.w, I meant optocouplers in my last post. I have no idea where the "isocouplers" came from! :roll:

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: fredag 2016-07-08 17:22
av FlyingSheep
Hi All
I now have a logical schematic for the circuit that will be used to emulate the rotary encoder on my induction hob. (drawn in KiCad).

Schematic_logical.png
Logical Schematic

The transistors and optocouplers shown are representative: I have not yet ordered the actual electronic bits yet.
Also not (yet) shown are the switch / socket etc. that will go between the Raspberry and the bits inside the hob case.
I am assuming that I will be able to generate the quadrature signal (turning the A and B channels on and off) in code on the Raspberry (but getting the a suitable frequency might be a challenge).

I am a little unsure If I need any additional electronic components on the hob side of the optocouplers. The optocouplers have a collector current of circa 50 ma, which should be higher than the expected max current of the rotary encoder I am emulating (although I have not identified exactly what part it is).

Cheers
Chris

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: fredag 2016-07-08 18:42
av bryggapa
Between pin 4 and +5v-hob you need a resistor (100ohm if you are aiming for 50mA). Then at pin 4 you have your signal (A/B respectively).

The current through the opto is of lesser importance for the signal, it is only the voltage that matters (close to 5v -> logical high, close to 0v -> logical low).

Emulating the rotary encoder with the raspberry is trivial. You just need to pull the pins high/low in the right order. Frequency should be irrelevant, but maybe not do it too fast. Use a delay (maybe a few milliseconds) between state changes.

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: fredag 2016-07-08 21:45
av FlyingSheep
Hi bryggapa

Thanks one again for you advice, and to be able to bounce ideas off you!

50 ma is the max forward current of my intended optocouplers, so I should be aiming for something a little lower. Although I cannot identify what the real rotary encoder is, browsing spec sheets of similar looking rotary encoders indicate that they have a max of 5 -10 ma, so If that is my goal current, then the resistor on pin 4 of the optocouplers should be more like 500 or 1k ohms.

I agree that the emulation code will be trivial. I am a software architect, so this is much closer to my comfort zone than the electronics. In python I will do something like:

Kod: Markera allt
...
GPIO.output(chan_list, (GPIO.HIGH,GPIO.LOW))
time.sleep(X)
GPIO.output(chan_list, (GPIO.HIGH,GPIO.HIGH))
...


The challenge will be to get the interval X more or less right. Dong some guesstimation: If turning a full revolution of the knob by hand takes 500 ms, and the encoder has 24 stops (giving 96 events per revolution); that implies a sleep of around 5 ms between events.

Somewhere I read that python sleep times under 50 ms get tricky, but on doing more research it looks like that on linux sleep() can be used for times down to around 1 ms. I don’t think accuracy of the interval is important, but it should be in the same range as that achieved by a human turning the knob. If my interval is too small then the micro controller will miss events, and If I turn emulate too slowly, it will likely register an error. I will need to experiment.

If pythons sleep() cannot provide small enough intervals, than I can use nanosleep() in C instead.

Cheers

Chris

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: lördag 2016-07-09 09:40
av bryggapa
Yeah, a 1k resistor sounds more resonable.
But the current through the rotary encoder or the optos is irrelevant(ish), you only need to make sure you're driving each of the within their intended range. It is only the voltage at the output that is of interest to the MCU on the other end. The MCU input is (very likely) high impedance, and won't affect the signal (significantly). You can think of it as a voltmeter (like on a multimeter). So you only need the signal to be high/low when it needs to be, the actual current doesn't really matter to the MCU.
The delay (and jitter in the delay) is not an issue (probably anywhere from a few hundred us to a few hundred ms will be ok). Using linux's sleep()or some python equivalent will be just fine. It is only to not send pulses too fast. Timing is very much non-critical. Only the state changes need to be in correct order.
A state machine is probably the best way to implement it, and just incrementing/decrementing the state variable to simulate turning right/left on the encoder.

Re: Extern styrning av Hendi 3500W (manuell) induktionshäll

InläggPostat: söndag 2016-07-10 20:45
av FlyingSheep
Hi bryggapa

All makes sense, and is as I now see it.

I had another peak at the controller pcb. It uses 1K resistors on the output of the rotary encoder, and as this will bring the (unimportant) current well down into the operation range of my optos, that is what I will go for.

Doing some mountain climbing this weekend gave me the opportunity to run through the design in the back of my mind, and revealed a new question. Until now I had only thought of controlling the power up and down. However doing so, the minimum power setting is 500 watts. This evening I put the hob back together to prove this.

Now If my control algorithm has achieved expected temperature, then 500w may be good as a holding position, but if I overshoot then it will probably be too much! This means that I probably will have to be able to control on and off as well. The on / off control is a push button on the control pcb.

So how do I best identify which of the nine wires in the JST ribbon cable are responsible for on and off? I was able to find channels A and B, and guess at GND by "reading" the traces on the back of the board, but have not succeeded in doing so for the traces from the on / off button.

Cheers,

Chris