Brewery

Hi i want to use Teensy 3.1 on my micro brewery. But im not sure about the current to drive the peripherial devices.
I need to connect:
1x 4Channel Relayboard w opto (circuit)
3x DS18B20
1x L298
1x Raspberry pi w 7" Display on UART
? 28J60 Ethernet Module for Modbus communication

I wanted to power all them from a external Power supply.
I plained to put Fuse on
1x 2A (Rpi)
1x 500mA (Teensy)
1x 2A (DS18B20, Relayboard, L298)

About Relayboard:
I measured the current on the Relay Board, which takes about 15-20mA if i connect the digital optoisolated Inputs only to 5V.
Can i use 3.3v too?
Can i attach the IO pins from the Devices directly to the Teensy 3.1 or i need to put resistors between?

About L298,:
I have read that there was someone who burned 2 teensy conecting the to a similar Board.
They wrote about voltage spikes on the 5V Line. Im not shure if the external Power source can handle that, i need a overvoltage protection?
They suggested to use resistors on the digital Pins of the L298.

I think the Serial communication between Rpi and Teensy will work whitout problems.
The communication between Rpi and Teensy is Modbus, because i wanted to use somthing like Codesys to controll the device but there is maybee something cheaper?
Thanks

wow, great subject line !

first off, relays have 3 separate power supplies.
you already know that the contacts is completely isolated from the controls, so that one is moot.
you have a power supply for the coils. relay coils can be any voltage, AC or DC, all depends on how they coil was wrapped and the materials used on the contacts.
the third is where your question lies. how to send a signal to activate the circuit that powers the coils.

there are many links on how to control a relay and using some form of FET or transistor is how you use a small signal to control a large one.

if you are buying any of the relay boards that have the opto-isolators built in, then your power requirements are no more than 20mA max, often much less.

so, you need a clean power supply for your logic stuff.
either some form of filter, isolation or separate power supply for your low voltage power control
and whatever you have or need for the contact side of the relays.

using a cap at the input of the arduino goes a long way to filter the voltage by relays being switched. a hefty switching power supply will have large caps to allow for the surge in the relays switching.

Start out with the simple connections, make sure you tie your DC ground together, and all should be good. only if you have problems should you need to make any special adjustments.

Hi, about the relayboard, i have updatet the post whit some infos… TheBoard is one of >this< wich has optocouple isolation. But i dont know if i have to use the 3.3V or if i can use the 5V at the VCC because the relays switch on at LOW state. >Here< is the cirquit.
The problem is that Teensy outputs 3.3 at HIGH state not 5V, so there are already 1.7V.

The coils need 5VDC (JD-VCC), wich i can separate from the optocoupler (VCC).

No, you use the Teensy's 3.3V at the optocoupler Vcc. The relay power supply JD-VCC is 5V. The opto isolator prevents that voltage from ever getting near the Teensy pins.

o5i_:

The coils need 5VDC (JD-VCC), wich i can separate from the optocoupler (VCC).

you have no care about the relay side of the optocoupler, your only concern is getting the 10-20mA to the opto-coupler.
you can easily do that with any 3v device

for all you care, the relay coil can be 120 vac and controlled by the optocoupler.

that is the whole reason for the opto-isolator. it isolates the signal from the power side.

Ok i have tried yesterday to switch the opto using 3.3 and it seems to work.
I have an other question about user interface.. I wanted to use the Teensy as modbus slave, but whit all the logic inside like industrial plc and the rpi as userinterface because of the display and the connectivity. But it is difficult to find some software wich is able to be modbus master and easy to program. I know some Industrial systems, they are verry similar (codesys, wincc...), but the open source things are more whit c/c++ implementation which makes me spend a lot of time learning this things. Somone can suggest me a open source scada system that runs on rpi and have maybee html5 support?

Why MODBUS? Do you really want MODBUS on Ethernet or Classic MODBUS on serial?

I wanted to use Modbus RTU, i dont need to share the things in network, but i wanted to use a Standard Protocol because i thought it is easier to implement and i can use something industrial. I realy want to avoid writing my own graphical userinterface whit protocol in C/C++ pyton or something like that.
But there is nothing made yet, so i can use anything i want.

For a one-off hobby project, getting MODBUS to work will be more difficult than designing the screen in a paint program.

I fhave already tested it whit the "simplemodbus" sketch.. No problem there...
The point is that i dont want to spend too much time learning something proprietary i need only one time. Coding on the arduino is more usefull for me, but it already worked how it shoult so no worry about modbus. i tried whit 50ms sequences on 19200.. Thats more than fast enough.. I think i go whit 9600 and 200ms, is fast enough and probably more stable..
But if you now a good alternative please let me hear.