Author Topic: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems  (Read 23304 times)

0 Members and 1 Guest are viewing this topic.

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #100 on: April 20, 2017, 06:33:36 pm »
The ATTiny102 has everything I need in an 8-pin package, including a USART, @ £0.50 a pop: http://www.microchip.com/wwwproducts/en/ATTINY102 Shame it only has 1k of flash, that might not be enough for a Modbus implementation.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #101 on: April 20, 2017, 07:10:48 pm »
The 8K flash ATtiny841 might be a better choice.  Ok, its a higher pin count, but its 20M2, 20-pad, 3 x 3 x 0.85 mm package is pretty small, (smaller than the full footprint for an 8 pin SOIC chip) and if you want to do serial comms reliably over a normal working temperature range, you really should be using a crystal or resonator, not the on-chip oscillator.   There's also an Arduino core for it if you want something easier than Atmel Studio.
 
The following users thanked this post: Lomax

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #102 on: April 20, 2017, 07:40:13 pm »
The 8K flash ATtiny841 might be a better choice.  Ok, its a higher pin count, but its 20M2, 20-pad, 3 x 3 x 0.85 mm package is pretty small, (smaller than the full footprint for an 8 pin SOIC chip) and if you want to do serial comms reliably over a normal working temperature range, you really should be using a crystal or resonator, not the on-chip oscillator.
I looked briefly at the "automotive" versions, which IIUC are slightly more ESD tolerant. Can't seem to find a price anywhere though, and if you need to ask... If this design is ever finished and proves successful I will need quite a few of them, but not a reel of 3000 :o An 8 pin chip would be nice, but if I can't find a small enough Modbus implementation the ATtiny841 might be the best bet. Note taken re. external crystal, though I think I already knew this somewhere in my cluttered head.

There's also an Arduino core for it if you want something easier than Atmel Studio.
The what now instead of the what now? I've only ever used the open source AVR toolchain & command line compiler, and the AVRDUDE programmer. Seems to work ok?
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #103 on: April 20, 2017, 07:54:17 pm »
If its not listed at MicrochipDirect, its future product vapourware.  You probably don't really need 'automotive' grade - it wont be directly exposed to off-board signals and the only possible issue will be the 85 deg C upper end of the temperature range for normal fully specified operation.  For the standard part, the usual major distributers seem to have stock in the EU.

If you are already comfortable with command line GCC and bare-metal AVR programming, ignore the Arduino comment.

 

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #104 on: April 22, 2017, 05:57:00 pm »
If I'm going to dive in and embrace RS485/Modbus + Node Red, I'll need to get some isolated TTL > RS485 converters. While looking around, I found this one: http://www.ebay.co.uk/itm/122282850664 Seems expensive @ £27 though, is it worth spending this much?
 

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #105 on: April 23, 2017, 02:17:27 am »
I see there are AVRs with built in CAN Bus controller, for example the ATMEGA16M1: http://www.atmel.com/Images/Atmel-8209-8-bit%20AVR%20ATmega16M1-32M1-64M1_Summary.pdf Maybe this is a better route than RS485/Modbus?
 

Offline ovnr

  • Frequent Contributor
  • **
  • Posts: 658
  • Country: no
  • Lurker
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #106 on: April 23, 2017, 09:19:31 am »
If I'm going to dive in and embrace RS485/Modbus + Node Red, I'll need to get some isolated TTL > RS485 converters. While looking around, I found this one: http://www.ebay.co.uk/itm/122282850664 Seems expensive @ £27 though, is it worth spending this much?

That's... not very well designed, what with the near-zero clearance/creepage distance.


On CAN bus: Certainly an option. Probably not a much better option though; it's a better protocol for a multi-master system (not entirely relevant here), but also much more complicated. You'll still need transceiver chips, but at least it seems like they have lower quiescent current.
 
The following users thanked this post: Lomax

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #107 on: April 23, 2017, 12:02:43 pm »
That's... not very well designed, what with the near-zero clearance/creepage distance.

Good point. I like the gas discharge tube though. And the send/receive LEDs - though I'd likely remove these when finalised, to save a couple of mA... Do you know of a better/cheaper option? Not sure I want to design a board for this as well, especially considering it's taken me weeks to (not) design the RTU  ::)

On CAN bus: Certainly an option. Probably not a much better option though; it's a better protocol for a multi-master system (not entirely relevant here), but also much more complicated.

All I know about CAN Bus is that it is "multi master", and that people keep saying it's complicated  :-\ Multi master is nice I guess, since it would allow the RTUs to push notifications, but I don't like "complicated". :)  My thinking was that the built in controller on e.g. the ATMEGA16M1 would save me at least the step of implementing the communications controller firmware, leaving me free to concentrate on the PWM/control side. I haven't seen any, but maybe there are MCUs with built in Modbus support?

You'll still need transceiver chips, but at least it seems like they have lower quiescent current.

Low power consumption is high on my priority list.
 

Offline ovnr

  • Frequent Contributor
  • **
  • Posts: 658
  • Country: no
  • Lurker
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #108 on: April 23, 2017, 12:36:15 pm »
The GDT is cute. It also doesn't do anything to prevent blowing the shit out of the transceiver, as it just keeps the data pairs within 100 volts of each other - they can still be at 1 kV to ground. ::)

The CAN bus hardware in a micro just handles the addressing and framing stuff. You're not likely to find hardware modbus support, because it's so simple you might as well just do it in software. Remember, this just deals with the low-end stuff - equivalent to level 2 on the OSI model. You'll still need to implement the rest yourself.
 
The following users thanked this post: Lomax

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #109 on: April 23, 2017, 01:14:51 pm »
The GDT is cute. It also doesn't do anything to prevent blowing the shit out of the transceiver, as it just keeps the data pairs within 100 volts of each other - they can still be at 1 kV to ground. ::)

Right-oh, so do you have any suggestion for what I should be looking for - or will I have to roll my own?

The CAN bus hardware in a micro just handles the addressing and framing stuff. You're not likely to find hardware modbus support, because it's so simple you might as well just do it in software. Remember, this just deals with the low-end stuff - equivalent to level 2 on the OSI model. You'll still need to implement the rest yourself.

I see. I must admit I didn't read too deeply; I just assumed the on board CAN Bus implementation would provide some higher level objects for me to use in the code. WRT Modbus support, I've found this library which looks quite promising: https://github.com/mbs38/yaMBSiavr Having looked at the code, it's not what I would call "so simple" - certainly not something I could knock out myself - but at least I can understand what (most of) it does.

 

Offline ovnr

  • Frequent Contributor
  • **
  • Posts: 658
  • Country: no
  • Lurker
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #110 on: April 23, 2017, 09:04:21 pm »
Well, this USB to RS485 converter looks fairly decent (with the caveat that it's impossible to tell entirely thru the plastic case - at least it's well isolated). Just rip out the FTDI chip inside and connect it to your Raspberry Pi or whatever. Or just use it over USB for that matter.

Alternatively, there's this one, which is more expensive, has worse protection but doesn't include a FTDI chip that needs to be removed.
 

Offline LomaxTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: eu
  • Minimalist
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #111 on: April 26, 2017, 09:36:21 pm »
Thanks to everyone for their contributions - especially @ovnr and @Ian.M. I'm afraid that time has caught up with me, and I'm going to have to put this project on hold for now - but at least I have avoided making a costly mistake. I will revisit lighting control for my boat at a later date, and that design will be based on RS485/Modbus; 1-Wire is dead - long live 1-Wire! But regardless of the postponement, there is one question which still has some urgency: cabling. Rather than spend money on cabling which will need to be replaced (once the 21st century catches up with the 20th) do you reckon I should invest in the Belden 1502R and run this to all the lights? Looks to me like it would work well for combined RS485 + power?
 

Offline ovnr

  • Frequent Contributor
  • **
  • Posts: 658
  • Country: no
  • Lurker
Re: RFC: 1-Wire PWM dimmer/motor controller for 12V vehicle systems
« Reply #112 on: April 27, 2017, 10:37:07 am »
It would work well. I'd probably balk at the cost, but I'm a massive cheapskate.
 
The following users thanked this post: Lomax


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf