Minimum hardware to amplify K8055 analogue outputs?

Jan,

Yes, that’s it. No DCC. If you start with PWM then it needs to be converted into continuously variable voltage. Otherwise, the kind of motor I envisage will overheat and the magnets lose their flux.
regards,

John

John,

in the case of the K8055 we are talking PWM at a frequency of 23.43 kHz. What kind of motor will overheat if driven by a PWM signal of that kind with a duty cycle of 0…100%?

The thing is, using a power transistor in a simple voltage amplifier setup, driven by a K8055 DAC output, is far from linear and inherits all the problems associated with voltage regulated DC. I finally found a small (160mA) 12V Brushed DC motor in a “junk items” box in the basement. Playing around with that kinda thumped me in the skull. When you try to control the speed of a motor with voltage, you have to ramp it to 2-3 times its lowest sustainable speed before it starts. I always hated that behavior with my old Märklin trains. They always catapulted away from a dead stop and there was no way to start them in a realistic manner. PWM control acts a lot smoother.

If you really need voltage regulation with direction reversal, take a look at the ESC modules available for RC models. I can control those with my modified K8055 right now.

But if the K8055 type of PWM is suitable and you can settle for a few more components and want a much better and more efficient circuit, take a look at this:

It will work with a stock K8055 and drive a 1A train just fine. If you need more power, like 5A, replace the Q2 with a TIP3055.

Regards,
Jan

Jan,

You are defeating ignorance and prejudice with the cool logic of practical experience - bless you for that!

I started my journey in 2001 with a British-designed all-in-one-box equivalent of K8055 with an external 12vac 2A transformer available with British 13A plug or USA/European mains plugs and 12v 1.5A small brushed DC motor outputs x 4, individually switchable but not capable of independently variable direction. It had 4 x variable analogue outputs you could use for smoke generation by using a heating wire run through your program from a pyrometer to keep the smoke oil from overheating and give a nice steady smoke emission. 8 x digital inputs, 8 x digital outputs @ 6vdc 1.5A … is this beginning to read like a K8061 with ‘H’-bridge motor amplifiers 'cos that’s exactly what it is and made by Economatics (Education) Ltd, Attercliffe Rd, Sheffield, U.K. at £366 i.e. $550. It caught my eye at my kids high school Science and I.T. Day.

I continue.

The ‘Smartbox IV’ had program variable voltage steps 0 - 3- 6 - 9 -12vdc and came with a primitive control program based on BASIC but with serial port commands, later u.s.b. port version like K8055/K8061.

I asked the company for a loan of all this gear and they agreed - even supplying their own control software called ‘Logicator’. I swiftly turned my back on that and hacked into the hardware using Economatics company-supplied data (!) and the infinitely more powerful MS VB5 compiler. I took another college course called ‘MS Access Relational Databases with VB5’ to lift me out of QBASIC 4.5 into VBASIC 4 then 5, finally 6 which is where I am now but with 14yrs solid graft at programming. Let me tell the scoffers who are reading this “VB6 is a helluva fine compiler if you are working from home in Robotics”. Velleman must agree or they wouldn’t provide us with enough stuff to command their products in it, as well as DELPHI etc.

So, back from the clouds, Jan. You’re quite correct about PWM working fine in this context. My fears stemmed from hands-on experience with ‘Smartbox’, watching smoke curling from my beautiful Hornby-Dublo “Golden Fleece” A4 model loco armature. The frequency you describe is far faster than that and you can vary it, I believe, on the K8055/61.

I wish I knew how to get drawings onto this platform so I can upload some of mine. It would make interesting viewing for you.

regards,

John

Even today a lot of PWM platforms are rather “slow”. The Arduino for example defaults to 500 Hz. That would be exactly where your type of DC motor would have problems.

The problem with low frequency PWM is that 50% duty cycle at 2x voltage equals twice the power and thus requires twice the heat dissipation. But that is only true if the motor is stalled. As soon as the thing is turning, the fact that a motor is an inductive load and has EMF feedback comes into play. The motor will smooth out the wave itself. In the end it is some function of PWM frequency to motor power. With increasing PWM frequency, the wave pattern will just look more and more like a regulated DC voltage.

Yes, I can control the PWM frequency of “my” K8055. But here we are full circle. That is the one I modified, replacing the PIC, the crystal and some capacitors. The original K8055 as well as the K8055N are fixed at 23.43 kHz.

I’m doing my drawings using ExpressPCB. expresspcb.com/

If I ever need hundreds or thousands of circuits made, I will probably use their services. Until then, I enjoy their excellent free software.

Regards,
Jan

Jan,

Thankyou for all that. It’s good to find somebody with your talent for explanation. My experience is depressingly full of ‘boffins’ that only seem to understand each other.

regards,

John

John,

it is the way I learn. And I have learned quite a few things through this thread, so thank you.

BTW, this thing looks interesting:

ti.com/lit/ds/snvs091e/snvs091e.pdf

They are a little pricey at about $15 a pop, but it seems they can be directly hooked to a micro controller.

Jan

Hi Jan,

I’m glad there has been mutual benefit. I have glanced through the link you mentioned and find it intriguing too as it is a similar approach to that of Economatics (Education) Ltd of Sheffield, U.K. The box I purchased after blowing up 2 on loan from the firm (!) proved inadequate for the job of driving trains but entirely equal to loco track sensors, via the digital inputs, and ‘switch’ actuation by a matrix system inherent in my software.

I would expect the I.C. in your link to be ideal for my purpose and thankyou profoundly for your interest and research based on your technical experience that I lack.

Very soon, I will be re-activating my website at www.smartrax-dcc.co.uk and this can be a vehicle for the transmission of data etc. otherwise than by this forum.

In the meantime I’d like you to look into connection using u.s.b. square and flat plugs between PC laptop ports and dcc control boxes particularly HORNBY ‘Elite’ and LENZ LZV100. We failed to get a ‘handshake’ but you have powerful experience at your command that we lack.

Good luck!

John

I’m not sure I understand. The easiest way to control a LZV100 via USB seems to be using the LI-USB.

You cannot connect a USB cable directly to the LZV100. It doesn’t look like the command station has a USB port. XpressNet is a RS-485 based serial network. And the timings on that net are so tight that IMHO it would be impossible to use any standard USB to RS-485 adapter. The PC has 110 microseconds to respond to the transmit window. The latency of USB is measured in milliseconds!

However, this is getting far from being Velleman related.

Regards,
Jan

Jan,

Let me explain,

My software has 3 branches. These are pure DCC, pure DC and both.

The Velleman-related content is found on the last 2.

The following relates to running MS Visual Basic 6 Pro/Enterprise as the command source.

A cable with RJ male connections is used to link HORNBY ‘Elite’ (via either of its 2 RJ female connections) to the LENZ Li-USB, which then connects to any laptop u.s.b. port OR via LENZ Li101F (previous LENZ modem model to Li-USB) through a suitable serial port-to-u.s.b. converter which goes to any laptop u.s.b. port.

If a PC tower has a serial port (most still do) then there is no handshake when the latter option is plugged into a comm. port on the PC tower.

If a HORNBY ‘Elite’ is connected to a PC laptop by using a square u.s.b. to flat u.s.b there is no handshake. Furthermore LENZ say extra source code needs to be added to the start of every XpressNet transmission. I have that code from them but there is still no handshake when it is shoehorned into my source code.

If the u.s.b. cable is employed to link a Li-USB to PC laptop there is no handshake even when the extra source code is in the program as specified by LENZ.

The only clue I have (from one of the aforementioned boffins (no name - no pack drill) is that 2 drivers are required, one being for VB, the other either a HORNBY one or a LENZ. But I don’t understand the nature of a ‘driver’. I know what a truck driver is though! Asking either LENZ or HORNBY for a VB driver gets drivel from both companies leading me to conclude they are deliberately withholding assistance for commercial reasons. I found that another (German) firm ESU, who make LokProgrammer/LokSound etc. did not respond to a request for their product to become ‘open-source’ like Velleman’s so users can write their own programs in VB or whatever to control the LokProgrammer module - which prevents it from becoming a relatively cheap, highly portable, ‘one loco’ DCC tester.

There. Run that through your Mk1 brain and see if you can come up with the ‘missing link’ that will let VB code talk to HORNBY ‘Elite’ or LENZ Li-USB via the modem cable square u.s.b. to flat u.s.b.

I hope you now see my dilemma as a novice in both electronics and programming, when faced with industrial corporations intent that their customers only use products they make. Velleman, I take off my hat to you for seeing the sense in being ‘open source’ and operating a goof-friendly repair service from Belgium to the rest of the world.

regards,

John

John,

according to the JMRI SourceForge pages, the LI-USB is internally similar to a LI101F with a built in USB to Serial converter. So that should make no difference.

I am not sure what you mean with USB square to flat. Is that a standard USB A/B cable? If so, make sure that the cable conforms to the USB 2.0 specs.

Unfortunately you have me at a complete loss with respect to serial communications under Windows and anything Visual Basic to begin with. I normally don’t develop under Windows at all. The K8055 client library is a rare exception. In my world a serial comm. port is a file named /dev/cuau0 or similar. Sorry, but I’m afraid I won’t be of much help in this case.

Regards,
Jan

Jan,

But it does make a difference. I found that if a converter from newlinkproducts.co.uk is used, a handshake will happen. By accident in my case! But a lucky accident and that’s what I want now so my customers can get the best model railway virtual layout control software in the world (i.e. mine) to work with the cheapest readymade solution in the world (i.e HORNBY ‘Elite’) and it even comes with a free A/B cable!

“Aha!” I hear you say, "What’s this got to do with Velleman and why is he pushing his product here? Simples - Any of 4 Velleman I/O cards can be used for the straight DC or hybrid version.

I’m surprised you can’t define ‘driver’ in the computer software context. Maybe I should try consulting a computer dictionary instead of trying to pick your brains.

regards

John

John,

the reason why some USB-Serial converters work and others don’t is because with these POS (plural, I have two of them) it is purely hit and miss. Some generate signals fairly close to the RS-232 specifications, some don’t. According to Lenz, the LI10xF devices are rather picky when it comes to spec compliance on the serial line.

The definition of “driver” is a bit fuzzy in the software world these days. It used to be the software layer that requires direct access to the hardware components, and thus often kernel privileges for resource access. But today people implement all sorts of functionality, that could just as well live in a shared library and execute in the user process, as a “driver”. Don’t know why they do that.

Regards,
Jan

Jan,

Whaever they pay you, it’s not nearly enough!

John

Hi Jan,

Long time, no see. I have now got a motor amplifier working but not very well, designed by a colleague in M.E.R.G. that’s Model Electronic Railways Group.

Can you post schematics?

Jan,

I don’t know how to post a WORD document *.doc on this site so I have included the complete document (devised and written by Peter Denton of MERG UK) including schematic within the Text subfolder of the Data folder in my ‘3D-Smartrax’ free software as posted on website www.traincontrol.co.uk

I look forward to your comments.

regards,

John

Hello John,

how are things?

It looks like a Power-MOSFET used to control a higher current with the PWM output. Although it seems to be designed as if the K8055 has the micro controller outputs directly exposed.

The relay could be switched with a digital output. The LMR2-12D relay has a 270 Ohm coil resistance. At 12V that’s 44mA, which is no problem for a K8055 digital output to handle. Not sure about T2, didn’t use too many Power-MOSFETs yet, so I’m not very familiar with calculating the gate current requirements here. But it is well possible that the BC337 on the K8055 can drive the power transistor directly.

What does “not working very well” mean?

Regards,
Jan

Little brain block there. T2 is definitely needed in this case to act as a NOT gate, so that the N-Channel MOSFET is ON when the PWM signal is ON. One could build this circuit without T2 when using a P-Channel MOSFET, but I guess your friend Peter didn’t have one of those in his scrap box.

Regards,
Jan

Hi Jan,

“not working properly” means neither the current reverser nor the variable voltage is working so I only get a fixed speed in one direction. This is because there was no diode protection in Peter’s circuit preventing an accidental voltage reversal that occurred.

I’ll tell Peter about your comment :-

“T2 is definitely needed in this case to act as a NOT gate, so that the N-Channel MOSFET is ON when the PWM signal is ON. One could build this circuit without T2 when using a P-Channel MOSFET, but I guess your friend Peter didn’t have one of those in his scrap box.”

-: because reducing the component count is bound to be better if performance is not marred.

regards,

John

John,

you mean you accidentally reversed the 12V supply? Yeah, that will wreak havoc on that circuit for sure!

If I find some time later this week I will try to come up with a solution that involves a regular PNP power transistor. I think I have a DPDT relay in my scrap box too. I don’t have a motor that draws 5 Amps, but a small 12V thingy will do fine for test purposes.

Regards,
Jan