Help schematic first atempt
#1
Posted 02 October 2011 - 12:21 PM
I am trying to make an aquarium controller, the basic idea is that it will do the following:
Wifi web controlled via a gainspan wifi module (serial com1)
Will keep time with a ds1307 breakout board (scl/sda)
Will display data on a sparkfun serial graphic lcd (serial com2 shared)
Take ph readings with an atlas scientific ph stamp (serial com2 shared)
Temperature readings using ds18b20's (1-wire com2 shared)
There will be extra outputs using 74hc595's (cs on pin 9)
6 SSR relays controlled from sone of the outputs from the 74hc595's
Com2 will be multipled using a 74hc4052 and this will be swithed using some output from the 74hc595's
There will be extra inputs using 74hc165's which may be used for input devices like a keypad. (cs on pin 10)
Data will be logged using a sparkfun microSD shield (cs on pin 8)
This can all be seen on my first attempt of a schematic which can be seen on the link at the bottom, the idea is that this will be like an oversized shield so this will sit on top of the sd shield.
I would really appreciate it if someone could help me work out how to get 2 daisychained tlc5940 pwm expanders in to the schematic to control led lighting, a few fans and a solenoid valves. Also if anyone can see any mistakes?
I have drawn the schematic using DesignSpark PCB and I can provide the projet file if it is any help.
Many thanks,
Andy
http://2.bp.blogspot...00/Aquarium.bmp
#2
Posted 02 October 2011 - 03:13 PM
What problems are you having with the TLC5940 - I'm using one of these at the moment and I finally got it working last night. I'm just starting to refine the circuit so that it will do what I want it but better.I would really appreciate it if someone could help me work out how to get 2 daisychained tlc5940 pwm expanders in to the schematic to control led lighting, a few fans and a solenoid valves. Also if anyone can see any mistakes?
I have drawn the schematic using DesignSpark PCB and I can provide the projet file if it is any help.
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#3
Posted 02 October 2011 - 04:14 PM
Really? I got it in front of me as wellWhat problems are you having with the TLC5940 - I'm using one of these at the moment and I finally got it working last night. I'm just starting to refine the circuit so that it will do what I want it but better.
Working on a library for it as we speak; wanna do it the same way as my 74hc595 lib.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#4
Posted 02 October 2011 - 04:31 PM
The SPI data transfer was the easy bit. I'm just working on trying to get fgsclk sorted out along with the corresponding BLANK signal. Got it working but only up to 71kHz using the Netduino to control BLANK but I want to get a 1 MHz circuit working. The Netduino is unlikely to be able to keep up at that rate.Working on a library for it as we speak; wanna do it the same way as my 74hc595 lib.
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#5
Posted 02 October 2011 - 04:51 PM
#6
Posted 02 October 2011 - 07:11 PM
Attached Files
#7
Posted 02 October 2011 - 07:48 PM
It will only be expanded, but I don't know when it's done, it's a difficult one! I got it working but with performance issues; managed SPI has got a hard time with itI guess there will be some changes to the lib's for bit shift stuff stefan?
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#8
Posted 02 October 2011 - 08:34 PM
#9
Posted 02 October 2011 - 09:09 PM
For now, you could use the library mentioned at http://dotnetdave.ne...th-the-tlc5490/I've worked out how to create a component in designspark now, so I have the tlc5490 ready to draw in to my schematic, bare in mind I am using stefans bit shift example using pins 9 and 10 for cs and the sparkfun microSD is using pin 8 for cs and, all share the spi 11 - 13, what pins would I connect the tlc 5490 to? Also as can be seen on the attempt of a schematic I have serial com1 going to the gainspan and the com2 serial is split for ph, lcd and temp using a 4052, there is one free channel on the 4052.
The connections I have:
GSCLK -> pin 7
DCPRG -> +5V
IREF -> GND
VCC -> +5V
GND -> GND
BLANK -> pin 10
XLAT -> pin 9
SCLK -> pin 13
SIN -> pin 11
VPRG -> pin 8
Don't forget to add a resistor for each led though! I use resistor networks for that.
Initialize it like:
Tlc5940 ic = new Tlc5940(Pins.GPIO_PIN_D13, Pins.GPIO_PIN_D11, Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D8, Pins.GPIO_PIN_D7); ic.Init();
The library doesn't use managed SPI, which has a few downsides:
- The pins 11 and 13 can't be used by other SPI-devices at the same time
- Performance is a bit low since it's bitbanged
But hopefully you can get a bit creative and get something working out of it anyway
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#10
Posted 02 October 2011 - 11:04 PM
#11
Posted 03 October 2011 - 05:51 AM
You don't need a resistor network if you use the IREF pin. Drop a resistor between IREF and ground according to the following formula:Don't forget to add a resistor for each led though! I use resistor networks for that.
Initialize it like:Tlc5940 ic = new Tlc5940(Pins.GPIO_PIN_D13, Pins.GPIO_PIN_D11, Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D8, Pins.GPIO_PIN_D7); ic.Init();
The library doesn't use managed SPI, which has a few downsides:
- The pins 11 and 13 can't be used by other SPI-devices at the same time
- Performance is a bit low since it's bitbanged
R = (1.24 * 31.5) / Imax
Imax is the maximum current per pin.
This assumes that all devices connected to the chip can operate with the same maximum current.
I'm interested in why you aren't using SPI because unless I have misunderstood my results this appears to work OK. Alright, you do not use CS on the chip but it does work.
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#12
Posted 03 October 2011 - 06:01 AM
Indeed, an assumption I prefer to just use a resistor linked to each led, since it's easier to understand though.This assumes that all devices connected to the chip can operate with the same maximum current.
It's not my library, I just linked it to help out, but still, I'm curious to 'your way'. Lets discuss that over with a pmI'm interested in why you aren't using SPI because unless I have misunderstood my results this appears to work OK. Alright, you do not use CS on the chip but it does work.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#13
Posted 03 October 2011 - 06:13 AM
Nope, not yet. But we'll find a way, I know your a patient guy (luckely )Thanks Stefan, will the above work with the other devices using 8, 9 and 10 as chip select? My knowledge of what can and can't be done is some what limited.
Both Nevyn and I are tinkering with it and I just sent him a PM to combine our strength. Hopefully we can create a steady base to work with for those IC's.
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#14
Posted 03 October 2011 - 07:06 AM
#15
Posted 03 October 2011 - 07:20 AM
I was starting to wondr about that point last night but did not have the time to test if it would work OK.The SS is the XLAT line.
I never thought about using the PWM on the Netduino for GSCLK - may have to give that a try. I have been investigating using an external clock built using a resonator (accuracy is not that important here). I'm having no luck in getting this working on breadboard - I've tried a resonator and a crystal running at 4MHz and I get nothing out of the circuit. I'll open another thread for this subject.The GSCLK should be driven by any PWM output (duty 50%) of the Netduino, so that the signal will be a square wave. I may suggest a frequency relatively high, let's say 10MHz, but I don't know what the Netduino PWM can do.
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#16
Posted 03 October 2011 - 07:52 AM
#17
Posted 03 October 2011 - 12:07 PM
Okay, I never tried it.I have moved to 4.2 as I was having to many issues, so I am waiting for chris to get chance to make a one wire verion, I will just leave out the 1-wire code for now.
Consider this thread first.The 595s are to control a number of relays and things like autofeeders eventually, also I use some of the 595 outs to supply 3 digitals to control the 4052.
Okay.The 165's are there for future expansion, maybe a keypad and auto top up switch etc.
Not sure about the meaning of "it can work off 3pins" (sorry!), but -at least- it requires the SPI wires (SCLK, MOSI, SS) and a 4th wire (VPRG) for switching between the Grayscale- and the Current-mode.I was thinking I would need to use a pwm port to control the 5940, I had a quick read of the datasheet last night to try to understand it a little more, apparently it can work off 3pins?
Right, but synchronous only. The UART cannot work.Serial I think?
The oscillator (crystal) of the RTC is 32 KiloHertz, not MegaHertz.Also if you need to suppy a square wave to set the frequency for it, I can't remember exactly but I thinkk it mentioned something around 32Mhz in the datasheets, couldn't you use the crystal the drives a ds1307 realtime clock like the one I have?
The TLC requires that clock (GSCLK) to generate the duty-cycle by counting up to the programmed limit.
Since the resulting PWM frequency out would be -generally- as higher as possible, the GSCLK should also be high enough.
For instance, if you feed the GSCLK with 1 MHz, the PWM out should be 1E6/4096=244Hz. I am NOT sure about this point, but that's what I understood this morning by reading the specs.
Anyway, if I understood right, 244Hz is too slow. If you have to drive a bulb or a heater, it can be even too fast, but if you have to control a motor (e.g. a servo), maybe you will need a higher frequency.
According to the specs, you may feed the GSCLK up to 30MHz. However, 30MHz is maybe too high if you don't know how to deal with stray capacitance, long wiring, impedances, etc. I'd suggest to keep the frequencies under 10MHz at most.
Mark suggests correctly to generate the clock from a crystal or a ceramic resonator. It's the most straightforward way, but it requires several components more (and your board is already plenty of them!)
The Netduino PWM output can generate a square wave for "free", because there's no need of any extra hardware to achieve it. Now, I don't know what are the actual limitations I heard about the PWM. If you will able to generate a PWM frequency of several MHz, and having a duty cycle of 50% (not mandatory, but better), you've done!
I guess you should make some experiment on a bread board with the TLC before closing the whole circuit: it is worthwhile.
That's very useful, and it's a pity that none consider it a bit better!I notice the rtc breakout has a pin called "SQW" which I am assuming is a square wave out? I guess the higher the squarewave the better the resolution?
However, I'd choose the NXP PFC8583 over the Dallas RTC. It's much more versatile, uses the I2C, more RAM, and an useful programmable-alarm output. There are plenty of ideas around it!
Cheers
#18
Posted 03 October 2011 - 07:44 PM
#19
Posted 04 October 2011 - 04:07 AM
I don't know whether this strip could fit your idea, but it seems perfect for an aquarium.
If your have to drive requiring enough current, you must use a transistor or a mosfet. Of curse you must use a decent power supply.
For instance, if you were driving this 5W/700mA LED, the very best way is to create a current regulator, NOT a voltage regulator. Since the LED works upon the current flowing into it, if you have a voltage (e.g. 12V) you must insert a resistor to limit the current, and that's a waste of energy. This particular led drops about 7.5V at 700mA, so the resistor will be R=(12-7.5)/700m=6.4 Ohms, but also wasting P=700m*700m*6.4=3.15 W of heat on it!!!
Instead, if you use a PWM current regulator, almost everything you get from the supply is actually used: nothing is wasted.
However, the circuit is more complex.
Cheers
#20
Posted 06 October 2011 - 07:36 AM
Any chance you could make this component available to the community - I could do with this so I can post a schematic to the work I have been doing.I've worked out how to create a component in designspark now, so I have the tlc5490 ready to draw in to my schematic,
Regards,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users