Category Archives: Uncategorized

RS485 & CAN Line Interface

I am just assembling one of my first Raspberry PI Hat’s With a 3 x RS485 and 2 x CAN for testing. The circuits below is what I used at the time. Rev 1.2 will use 3.3V only and remove the components crossed in Red.

It is a common error to add protection towards ground, but what you actually do is to force ground to be part of the signal. RS485 and CAN are both differential signals that should not need ground. If you need protection use the galvanic Versions! Even worse, the “protection” will disturb your signal quality at higher speeds.

Another issue here is that RE and DE is connected – this works, but it prevents some options – etc reading as you send to detect conflicts and disabling both sending and receiving etc.

The rev 1.1 also used some 1206 Components and a mix of 3.3V and 5V, as well as a XC6206 3.3V regulator in SO23 package. This will all be replaced with AMS1117, 0603 packages and 3.3V Components. Rev 1.1 also had the mistake that I implemented ground plane on both sides – it is not realy a mistake as such, but it makes it harder to assemble prototypes by hand.

RS485 Circuits

This is a classic RS485 circuit that I realize is not that good. It works fine, but it requires that ground always is included because of the 12V diodes.

This simplified circuit is in many ways better as we actually can use a twisted pair only. This shows a none-isolated RS-X port. I also drag both RE and DE into the MCU so we can send and receive at the same time. In fact, I could save a pin by setting RE to GND and always receive. I also avoided the leds and some 47Ohm line resistors. I also change to 3.3V version.

This last circuit is a fully isolated RS485 using ADM2582E. This includes a DC/DC and is completely isolated, but it also requires more space and cost ca 5.- USD more.

3D Printer – Prusa i3 MK3 w/MMU

Josef Prusa recently launched 2 3D Printer upgrades that are worth noticing. One is the MK3 and the second is the new MMU Upgrade for the MK3. The total price of these will be something like 900.- EUR. I have copied pictures of them below:

MK3 implement new technologies that are very interesting comparing with what I have on my MK1 clone. The most noteable is the new print plates and the new controller board that uses the TCM2130, a Ramp with SPI allowing current (torque) sensing. This allows the printer to sence end stops.

Multy Material Upgrade with 5 different, or 4 different and dissolvable support material is also very nice.

The most important changes compared to my old printer is however the Marlin firmware and Slice3 slicer upgrades available in open source. That said, I must admit I consider saving up for the MK3 with a MMU. Videos demonstrating this is very convincing.

Brother DCP9015CDW

My first laser printer (a HP) stopper working after years of usage, and I have been in the marked for a color laser for some time. They had a Brother DCP9015CDP on sale, so I went for it.

This is a large All-In-One printer with Wifi. It was dead easy to set up and my wife was happy to see it install on her Mac. The print and colors are ok. I am not sure this is the best printer for photo prints,but I got a big surprice as I printed – it prints on both sides.

Prnter, Copy machine, Scanner and it is soundless except then it prints. The cost in my case was ca 300.- USD so I am happy.

Based on my previous experience I bought the laser some 10 years ago for 100.- USD and have used 3 cartridges costing ca 100.- USD in 10 years. The cost I had in inkjet printers was much higher and the double sided print will cut my paper cost by 50%.

The only thing I actually miss is A3 print for schematics, but I will survive.

3D CAD – Autodesk Fusion 360

I have been in the marked for a CAD program for some time and finally realized that Autodesk Fusion 360 is free for non-commercial and minor commercial usage. It also have loads of training videos to get you started. I have only been using it for a day, but it seems to do the job.

Actuator-/Sensor-Design

Making an Actuator- or Sensor- Control System require a little bit of software. It is many ways of doing this, but I always tend to use a pre-tested design containing of 4 main parts:

Communication is always required as we either take instructions or send data/progress to another control unit. This is usually also the largest and most complex software component needed. Many designs will implement a communication protocol and the app as just an extension to this. Myself I use an Object Dictionary.

Object Dictionary is a generic database interfacing between multiple applications using the same data. In its simplest form it is nothing but an array between data communication and sensors/actuators mapping data. A more sophisticated feature often needed is data integrity. As communication is capable of writing partly data we need a mechanism to commit or rollback so that the application only see consistent data sets. Another feature is the capability for persistent storage on selected variables or straight forward database queries.

The various user modules are Actuator(s), Sensor(s) and various other modules either using or providing data.

The last bulk of code is the infrastructure with RTOS and utilities.

The main issue here is that this design only need a map of data in the object dictionary, the right modules added and it adapts to any actuator sensor design.

UML – Modelio

Testing a new UML tool “Modelio”. This is a GPL, open source. Obviously made in and for Java. I quite like parts of the tool, but I admit that I find it a bit slow to work with yet.

They have however done some clever thinking around lines in the class diagram. Rather than having separate lines the tool allow lines for inheritance to be combined. Inheritance symbol (triangle) is a bit small for my tastse.

Saving a project is slow so I suspect the format is a database rather than XML. I find it a bit clumsy to add attributes and functions to class, but I also admit that I don’t know the tool yet.

What I don’t like with some Java applications is that you actually notice that it is written in Java – it is that slow. But, speed of the app itself is not critical, more critical is the speed of work once I know the tool. I did however like that I can edit directly in the tree at left, so speed here might be an issue of learning the tool.

Micro/Pocket PC

This is a 5″ display and the keyboard I just ordered. I think the size is about correct. The trouble is more finding a TFT display that hide the HDMI on the back (inside) rather than demanding cables extending to the sides. I actually need a workable console for Raspberry PI that include both keyboard and display and don’t occupy to much space – interesting…

PLC Cottage Surveillance

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

Isolated RS485

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.