My grandparents passed away some years ago leaving a beautifully mountain farm behind. As no-one lives up there we have to leave the farm unattended for months at the time. This is a challenge in winter time as we fear the water pipes with freeze. The farm actually got internet installed so it is possible to use internet to create a remote controlled automation system.
Using Internet for anything you need to address security. Using Windows these days is not an option, so I am happy for Raspberry PI as base units. I am no web service expert, but I believe I can communicate directly between my home and the mountain farm by using a Address Lookup Service that we need to create. Basically the HMI and PLC both connect to internet and get details of whom to communicate with through a public service. Once the address is known they create a secure tunnel for communication. I will deal with security later, for now lets just assume this works and that we can use mobile devices as HMI.
The system I want to create will consist of a range of modules:
- Redundant PLC Base with mains, battery, wired and mobile internet connection as well as connection to sensors and actuators.
- Sensors for temperature, humidity, water leaks, light, movement etc.
- Camera, speakers and microphones. Actuators swithing on/off heat, opening/locking doors etc.
I use the mountain farm as design base because it present a few challenges. And I obviously want to control this using Plain.
Isolated RS485. I seldom bother with terminator resistor on RS485 because I never have errors due to this below 10 meters. Bias is a different issue as I experience problems without bias resistors on one side even on very short distances.
The main difference between RS485 and CAN is that CAN uses arbitration and is depending on better timing. RS485 is in contrary much easier to get working even with lousy solutions and cabling.
This is an isolated CAN-HS interface. ADM3053 offer a all-in-one package that cost a bit, but I decided to try it out. As for cost we are talking about 5.- USD rather than 0,5 USD.
A normal transceiver will give some protection while ADM3053 protect against much larger pulses, but it is not unlimited. Your level of protection should be adapted to your usage, and using a galvanic isolated CAN interface is basically an overkill for most hobby projects.
I need to test if I can get away with this simple circuit. The only challenge with CH340 is that it’s documentation in English is limited, so it’s a bit difficult to read up on all the pin options. But, I have seen others attempting this so will give it a try. This is CH340 as minimalist as possible with UART on one side and USB on the other.
The reason I like this is quite simple. We bought RS485 adapters for 1.- USD build on these some time back and now we simply don’t bother with anything else. They simply work to well. They always install correctly on Windows with no fuzz.
Updated the W5500 Ethernet schematics. C9 to C15 present a challenge in PCB routing since I am using 0805 packages. They are supposed to be attached close to each AVDD pin which is a challenge. Also I added the L1 ferrite bead to stop 100Mhz signals from crossing over.
But, I am still thinking that the 8.- USD breakout (below) is a tempting simplification. Particulary since the footprint will be smaller with this. I am also thinking that these breakout boards will even drop in price later.
This is the breakout board version of W5500 available for 10.- USD on AliExpress. I have a few of the more expensive ones for W5200 bought from Wiznet. Using breakout’s like this simplifies the prototyping if you assemble by hand. I also notice that Wiznet support examples for STM32F103 using CoIDE these days.
This Picture show the actual PCB With W5500. Notice the small 0201 Components. The 0805’s look massive in comparison. Usually I can use less Space adding the Electronics directly, but this is an exception. The cost of W5500 and Components are ca 3-4 USD, so 10 USD could be an acceptable trade to make it simpler.
They Reference the Board as “USR-ES1” and looking at Pictures I see a different PCB (see bottom Picture), but I assume the pinout is the same? It exposes SPI, Reset and INT, but it does not expose the PMODE pins.
This last Picture is from a different Product also marked as USR-ES1. This actually looks like it has been hand-made and not so Nice as the first one.
Lack of PMODE means that the module is wired for auto-negotiation. This can be an issue in robotics because we often have long cables and connectors of various quality. The result can be a 100Mbps that is unstable, so we need a way to force it to 10Mbps to make it stable.
This is mostly the reference schematics with minor modifications.
Ok, I underestimated the size and number of passive components around W5500. I was hoping to assemble on only one side, but I either need to increase size or assemble on both sides. This is 0805 components. I can use less space with 0603 and choosing a smaller x-tal. But, 0603 start to get difficult to place manually.
The demo board uses 0201 components, so if I had access to a professional assembly line this would not be an issue at all, but as a hobbyist doing prototypes you need to make these considerations.
I have plenty of RS485 USB sticks that I bought for 1.- USD each. They are great, but I lack the same for CAN. And I lack low cost sticks for CAN Low Speed/Fault Tolerant. The larger com adapter is great, but I will need cheap ones I can afford to loose.
In this I will be using TJA1050, TJA1055, the smallest STM32 (LQFP48), CH340 and a USB connector to make a simple, dumb connection from CAN to USB. The total cost should be something like 5.- USD.
This is an early draft with only the main components mounted. The schematics are not even close to done yet. I like to place main components straight away to get a look & feel and in many cases I adapt schematics to physical layout. I know some prefer to complete schematics before they start PCB layout, but with modern tools I find it easier to just get the packages and dump them on a PCB. The larger chips often need to be rotated for optimal routing and sometimes you can change components or select a different SPI/UART etc based on what is most optimal.
I have several issues already. The areas at left with the yellow marked isolation space is fine. I have plenty of routing space in that area. The area around W5500 is however tight. An obvious solution would be to swap Wifi and Wired Ethernet. I don’t want to move the led’s up because they will end up under the SWD adapter, but moving W5500 up should work.
I have used ESP-03 simply because I had a pre-made package, but I am thinking of replacing it with ESP-12E. The later is a little larger, but have the same form with legs on the side that will hold the breakout board in place. The NRF breakout have an issue as all legs are on one side. This will make it weak as the other end will tilt up and down and vibration might break it loose. I have seen different solutions for NRF24L01+ so will look into that. The USB is placed in the middle away from the edges because it is held with those 4 large pad’s. These are GND and need extra support to provide mechanical strength to hold the USB as we plug in and out. As mentioned in an earlier post I had issues with this on a different board.
I hope to have the first draft of this ready to order PCB’s tomorrow.