Category Archives: Common

Inline AES 256 / CBC Implementation

Today I like to share some encryption code, which can be used in various situations – and is also useful for embedded systems.

It is a unique implementation of the AES 256 / CBC crypto algorithm. The goal of this implementation was neither speed nor size. It was written to inline it into existing code.

The compiler will create a new instance of the algorithm on the fly, at the place where you insert it into the code. Depending of used optimization flags, this inlined code can get very compact.

Goals

I had numerous goals and constraints while I created this implementation:

  • Completely inline.
  • Generated by the compiler on the fly.
  • Easy to read and understand.
  • Suitable for embedded processors.
  • No static tables (S-Box) in memory or the binary.
  • Minimal dependencies (just stdint and cstddef headers).
  • Compatible with other AES 256 / CBC implementation.

The following things were not relevant to me:

  • Speed
  • Size
  • Multiple algorithms
  • Error checking of inputs

Requirements and Usage

The requirements are very minimal, all what you need is a C++17 compatible compiler which provides the stdint and cstddef headers for the uint32_t types and the size_t type.

Continue reading Inline AES 256 / CBC Implementation

Good Quality Boards from PCBWay

Recently I received boards for a sensor array from PCBWay. This boards were made in a very good quality considering the low price level.

I really like the green solder mask they use, it creates a nice optical effect shifting the green colour towards yellow somehow. The solder mask produces a very nice contrast between the copper and non-copper areas, easy to see all traces.

lucky-resistor-2

The small traces on this board have a width of 0.2mm with an insulation of 0.3mm. It is a lead free HAL which is nice and flat.

lucky-resistor-3

Production time was two days (over the weekend) and shipping using DHL took four days.

lucky-resistor-4

Routing of the boards is nice and smooth, there are no traces of tabs left on the boards.

All boards will be connected with a kind of bus in a circle arrangement as shown in the title image and the image below. There is an address selector on each board, to assign each sensor board an unique address.

By splitting the design of the sensor array into five equal boards, I could save a huge amount of production costs. Producing 10 of the shown boards, lead free HAL, with a production time of 2-3 days was just $19.

lucky-resistor-1

If you have questions, miss some information or just have any feedback, feel free to add a comment below.

Have fun!

PCBite Kit 2.0 from Sensepeek Arrived

Last week the new PCBite Kit 2.0 from Sensepeek arrived. The new kit comes with the great PCBite holder from the previous version, which are very useful to fasten a PCB for soldering, rework or analysis. New to this kit are the handy probes, which also can be magnetically attached to the mirror board.

lucky-resistor-1

The mirror finish of the board let you keep the bottom side of the board in sight while you are working on the top side. It is a very useful feature, like in the example shown in my photos where I analyse the communication of the snow flake board and can see the LEDs on the bottom side.

lucky-resistor-2

The probes have a nice weight and come with a very precise gold needle tip. You can easily place them on even the finest pin or trace. The tip contains a spring like a pogo pin, therefore it keeps an equal amount of pressure on the board and does not move if there are vibrations or if you carefully move the board around.

With each probe, there is also a different needle with a crown tip. This alternative tip is more like a really tiny fork to be placed on small wires and pins. Continue reading PCBite Kit 2.0 from Sensepeek Arrived

Open Position for Step-Up Converter

For a current project I need a step-up converter to get 5 volts from 2.5V-5.5V input. The output of this converter is used to power sensors which drive motors and small heat elements from this source. The average consumed current is 160mA with a peek at 320mA.

In the photo you can see the latest Boldport project with a test setup for the XC9142B50DMR-G from Torex Semiconductor. I made the mistake and just relied on the specifications stated on the website from Mouser:

mouser-info.png

This looks really good: 500mA output current… So I did a quick test. Obviously the magic smoke in the photo is a composition, but this is what actually happened somewhere at a constant ~250mA load with 5V input. Continue reading Open Position for Step-Up Converter

Adafruit PCB Coaster Arrived

Today I got the PCB coaster from Adafruit. They look so much better in real than on the photos in the shop. The coasters are made from 2.4mm FR4 PCB material. There is a transparent solder mask on the top to protect the copper and gold elements. The frame around the image is black silkscreen.

I really like the combination of the cold and coper colours.

The coasters were designed by Saar Drimer at Boldport. You can buy them in the Adafruit shop.

lucky-resistor-1

lucky-resistor-2

Perfect Snow Flake Panels from Eurocircuits

Eurocircuits delivered some perfect panels for the snow flake board. Each panel has five snow flake boards on it.

lucky-resistor-4

This was an impressive good job from from Eurocircuits. There are a quite number of challenges to produce panels in this outstanding quality:

  • The width of the small decorative lines on the front is just 0.15mm. It is hard to get the HAL evenly over the whole surface with lines in all directions like this.
  • White solder mask would show every imperfection. You really can not hide a thing with this colour, it benefits greatly from a clean-room.
  • Milling this board outline is not simple either. You need experience, where to place the bridges to create a stable panel.

lucky-resistor-1

Most vias are tented, which is very nice. These are 0.25mm diameter holes, so it is at the upper limit where tenting works.

I am very happy with the result! The people at Eurociruits have clearly demonstrated their skills and commitment to quality.

Now it will be a real challenge to assemble the board without leaving any marks on the white surface. 🙂

 

Plant Watering Sensor Files

There was a long delay with no update about my projects. The reason for this is, I focused on other non electronic related projects. I promised to publish all files and information about the plant watering sensor project in August, and here are all the files.

First some Important Notes

Even with these files, it is a very advanced project to do. To produce the PCB, you need a board house which is used to precise and high quality PCBs, like Eurocircuits. Also all pads are prepared to reflow soldering, and not hand soldering. It may be possible to solder the resistors in place using a regular solder iron, but it will be hard to do.

Continue reading Plant Watering Sensor Files

Plastic Cup Meltdown – Working with Epoxy

Currently I am working on the coating for the foot part of the plant watering sensor. Here I already tried a wide range of techniques and materials. At the moment, epoxy seems the perfect material choice – so I am trying different resins and hardeners to get the best results.

Some hardeners are very reactive and produce a very strong exothermal reaction. While I read and prepared everything meticulously for a new process as usual, I still get sometimes very bad surprises.

For the process, I dip the foot parts into the epoxy resin and hang them up for drying. To waste as few as possible epoxy resin, I used very small plastic cups for dipping.

The exact material of this plastic cups is very important I learned. You should never use something which will react violently with the mixed epoxy resin, as you can see in the next picture.

lucky-resistor-1

The cup literally started burning after a few minutes and I had to drop it outside on the forecourt to prevent any disaster. In the picture you can see the remains of the process: A beautiful frozen epoxy block, in the middle of the melt down. The cold air outside rapidly cooled down the process, so the burning stopped.

Mental notes for the next experiments:

  • Use only cups where you exactly know the material.
  • Keep a stop watch running with the pot time, assume 20% shorter time as specified.
  • Prepare an evacuation/meltdown plan. 😉