Studio Contrechoc

design & textile & technology entries

Category Archives: making boards

KH-940 and Teensy 3.1

The experience with the knitic board as a shield on an Arduino Due for connecting the machine knitter KH-940 with a laptop was not very positive. The board is very fragile. Connecting and deconnecting making it needing constant repair.

After the e-textile summercamp a week was spent on making a new board, connecting the ULN2803’s and programming the Teensy 3.1.

The Teensy 3.1 microcontroller has enough pin’s, it is small and cheap.

Because the Teensy is running at another speed, 24Mhz, the delay’s between the Serial command sent from the laptop to the Teensy had to be altered.

With the program code of the older board (already reprogrammed to reduce all unneccessary communications) flashed to the Teensy not only whole tours/lines were not read accurately, also single pixels inside a tour:


The mistakes in communication in red, the red borderline below indicates the mistakes in lines.


The mistakes in lines are removed, but inside the line, there are still mistakes in pixels.


Making delays between Serial asking the laptop for data and receiving the data larger, the picture is received without mistakes.

The board connecting the ULN2803’s with the Teensy had to be adapted too, because the Teensy is working at 3.3V while the sensors of the KH-940 require 5V. This 5V is taken from the KH-940. The Teensy runs on the USB. Also the Teensy is not resetting if Processing is started, like it does witht he Arduino. So the initialize function had to be refined.

knit8 ULN 2803

knit7The big connector is printed with a 3D printer

knit5The connector with 10 and 8 pins are made from 2 5 pins connectors

knit6 The board with 2 extra potmeters to make the analog read run at 3.3V.

knit4 The Teensy 3.1

knit2 Testing the knitting from the board

Teensy (arduino script):

Processing sketch:


Writing my own software for the KH-940

Last year in 2013 I joined the lobotomy workshop of in Bruxelles. We made this knitic board (now called the first version) and did some experiments, which failed using my board on a KH-940. But in the end I was happy anyway, full of plans to make this work! It took a bit of time!

On the school ( we had the KH-940 knitters but I didn’t want to test too much on these machines for the students. After a fail I abandoned the experiments.

Before the summer I bought my own Brother KH-940 which I tested during the etextile summercamp: I discovered much more than the Nordic knitting technique!

For me the knitting of images using the Nordic technique was already “normal”, we could do this using Designaknit at school:

Back in Rotterdam, besides discovering patent, slip, tuck, ajour (knitting a sock too πŸ™‚ ) I could try to re-lobotomize my knitter. Then (after lots of frustration) I analyzed this board and by measuring I discovered that the PIN 2 of my Arduino Due board was always GND. Since this was a PIN used by the needle count it was obvious important signales were missed. This was easily fixed by assigning another PIN.

During the summer I used the software of but i noticed that lot’s of time the needle count was lost and the image shifted out of view:

I decided to program my own software. That took some time, analyzing the sensor information and building up the Arduino software in combination with the Processing software.

The main point discovered was that the sensor information from the knitter was lost if you sent too much information to the laptop. The knitter is sensing a lot of stuff and we need it all. So in the end the information sent to the laptop is minimized as much as possible.

(and what do you do when software is not working? you add checks, in this case sending more and more information to the laptop….resulting in a real knitting disaster, because then even more signals were lost. πŸ™‚

The second point was getting the offset right for the solenoids. This took some figuring out, because the belt and the carriage have several ways to connect. By discerning between four ways to combine carriage and knitter apparently all possibilities were tackled.

My software is tested further, and I suspect that there will always a dependency on the type of laptop, because the Serial Port always needs some time to “digest” between sending and receiving signals. So if either the Arduino or the Processing sketch go too fast between sending and receiving on either side information can be lost. (The laptop itself, when attending other tasks, can also be a cause for losing information as could be seen in my interface, where sometimes the image is truncated.)

The processing sketch has a basic interface, showing the image and the tours you are knitting. A few nice sounds accompany you while knitting and signaling the end of the knitted image.

Hardware board: basically arduino Due + connections to the KH-940 sensors and 2 ULN2803.

See:, although their board is much more nice now then mine, which was their first version, but is works. And they have developed this fantastic double bed version!

2014-10-11 13.10.56 2014-10-11 13.11.02

Basic interface made with Processing, showing the image, and the tour you are knitting.

2014-10-11 10.14.35

Needles are set according to the knitted tour.

2014-10-11 10.14.51

My fascination is to use the “other” possibilities of the KH-940 for datavisualisation: the slip stitch, the patent stitch, the tuck stitch, well that is starting to become possible…..see next post).

Working at a 3D printer at the same time with the same imagery of datavisualisation you notice one thing: the knitter is not a printer! The knitter is much more like a usical instrument. Knitting will always involve handwork, never be a push the print button and wait action…..:-)

The software can be found here, but as mentioned there is a dependency on laptop, so be careful! First version not documented yet. Still testing!!!!

One remark about Open Source. I always like Open Source code, because it allows you to start fast and comfortably. But then you have learnt nothing,Β  beacuse you are using other people’s code. If something goes wrong….you have to do it yourself anyway. Making it yourself costs a lot of time. But then you have your own code, you know the structure, and you have learnt something…

Open source is a bit like Fast Food! Better also do some Slow Cooking!

Se more scripting details in this post:


RFM01 and RFM02 libraries (version 0.1) for arduino 18

We bought RFM01’s RFM02’s and RFM12, a few month ago.

Eventually the RFM12’s worked with the library of We modified this libraryΒ  a little bit to seperate it from the Ports.h.

The RFM12’s communicated very well, and we did (and will do) several first projects with these transceiver. (see former posts) Although it is sufficient to use these RF12’s we still had a bunch of RF01’s and RF02’s.

So we set out to get also these senders and receivers working.

First we tried to modify the library of jeelabs for the RF12 to get it working for the RF01 and RF02. We learnt about the SPI of the ATmega168 (and 328), the fixed (Master Slave) registers PB5 – PB2, and about the interrupt on PD2. (Of course in a first stage we tried to change the pin numbers but that failed, we now knew why.)

But the RF01 nor the RF02 worked. Finally after trying A tiny remark in the descriptions of the RF01 and RF02 explained why: before the datatransmission you have to send the command 0xC6 and this cannot be done SPI. SO this is why the examples use different (slower?) methods.

see for instance:, but more to the point just the datasheet of the atmega168. There you can also read about the interrupts.

Even before the RF12 lib of we found the RF01 and RF02 examples of Benedikt on but the first time around these did not function. Now, with more experience in settings and wiring these examples worked.

We got transmission using these slightly modified avr projects. The frequency is 434 MHz with the idea of also talking to the RF12. This last attempt failed, are there other settings?

two arduino’s with floating rf modules 01 and 02 working with the libraries

We used the RFM01_Eva (together with RFM02_Eva, and RFM12_Eva) to compare all kinds of settings.

The programming was done using AVR Studio 4 using a AVRISP mkII. We have made our own experimental board (minimal components) but also used the arduino with the programmer.

Then we made a first version of RF01 and RF02 libraries for the Arduino (arduino 18). This is relatively easy and gives us the freedom to include the wireless stuff in other arduino projects.

We combined it with the library we assembled using wiring and a liquid crystal display, to check what was sent and if it was sent well. ( using the liquid crystal I2C lib we had made earlier.)

Then we had these two test (arduino-) projects used to send and receive a simple text. (The receiver uses the Liquid Crystal AT161.) The pins used can be found in the library scripts.

Now we face the question: do we facilitate lots of fancy stuff and make the library less accessible or do we just provide a testing base for everyone to be extended?

πŸ™‚ the answer is this: sketches of the RF01 RF02 libs, working in the arduino version 018 can be downloaded here if you want another frequency than 433 you have to look at the code in the lib.

We always try to document the technical side togehter with experiments in design, so also a few pictures of PCB we made using ferroIIchloride. We have drawn with a marker on the copperplate and etched it for about an hour. This way we can make PCB’s which are more fun than the usual very straight rectangular boards…

a test of etching with a working sender RF02
a banana shaped etched pcb for an atmega168 and an RF01 and RF02, the components will all be surface mounted

Preparing a RFID board

To make the assignment for the ATTINY44 more fun, I am racing to get another board working with a RFID reading chip.

I have done experiments with the Phidget RFID reader, which works perfect of course but is expensive, around 50 euro’s.

Then I found the at a rfid kit of 15 euro’s, which I built and tested. I made the coil winding myself it was very sensitive, one more or less made a big difference in response.

The circuit was based on the ATMEL datasheet of the U2270B.

So I realized much of the board was not needed, buying this chip for 3 euro’s at But the capacitators needed are not so current?? Anyway I had to compromise a little bit with the parts.

I reprogrammed the attiny2313 in BASCOM. In BASCOM there is a function (readHiTag) which reads the data coming from the CHIP and makes them into the 5 HEX numbers needed.

Making the board for the MODELA milling.

U2270B is not in the library of Eagle.
I had to construct the U2270B part in EAGLE and make the board. Because I was using only one layer I puzzled around with “big” resistors to make some crossings.

Here are some pictures of the board and the schematics, files will be added if all is tested and works.

I printed the board on paper to see if the parts would be fitting.

There were a few problems: the capacitor below the chip was too close and the connections with the coil were too small, so the copperfoil came off from the board.

But testing the rfid board and chip worked! (The script was in basecom and the chip I used was ATTINY2313 )

Stupid was not to give the resistors a value in EAGLE, I made the mistake of putting the wrong ones in, thinking all of the resistors were 10K….:-(

So I made a few modifications and at the same time made the board more five sided πŸ™‚

This is the rectangular old board, here is the five sided new board:

Linking a button board to FLASH

I wanted to do something more with the button board. As a contrast to the very technical looking board I made a soft button of artificial fur and connected it to the board at the small button.

Then I used Tinkerproxy to be able to get the input from the serial port to FLASH. Serial Proxy is also good to use. Actually Tinkerproxy cannot talk back to the board. With SerialProxy you can talk from FLASH to the board. (Tinkerproxy and SerialProxy are free.)

In FLASH i used some actionscript to get the input from the socket and started a sound and a text at button-down and started a small video bit at button up.

The text displayed in the textfield is actually coming from the board, this text is in the HEXFILE, of course it is very easy to make the text in FLASH too.

Here is the link to the FLASH file:

I have made a movie from the actions with the button board which i uploaded to youtube:

Debugging the Button board

blog in progress

What to do and how to check if a board does not function?

First of all check the cables.

Serial connector:

With a voltmeter check the input on the serial connector there should be 8-9 Volt on the right to small wires.

Then check if this cable transmits the voltage to the board. So first check if the voltage is on the steel parts of the connector. Then if the voltage is passed through to the copper lines of the board.

(In my case the second connector pin to the board from the left was loose two times.)

Then check if the chip has a voltage of 5 Volt over pin 4 and 8, see datasheet. (look for it in Google under ATTINY45 pdf )

Use the resistance part of the voltmeter now:

Then check if the other pins of the chip are connected to the second connector. Pin 5 should be connected to the left pin of the connector (MOSI). The pin right to this should be connected to pin 1 (RESET). The middle pin of the connector should have resistance 0 with the Ground, GND pin 4. The pin right to the middle pin must be connected to pin 7 of the chip. And the right pin of the connector is the MISO, pin 6.

Then check if the left pin of the connector is having resistance “infinite” with the middle pin of the connector. Also do this checking against the ground (middle connector pin) to the pin to the right, MISO.

Second connector on the board:

         9        18        10
   | MOSI (3)  GND (2)  MISO (1) |
      -RESET (4)  SCK (5)
            7        8
                  | cable direction

I had a shortcut of the MOSI with the GND, very strange!

The programmer warned me about it, and it was right.

Now the programmer, or avrdude cannot complain anymore!

PCB making: programming troubles

blog in progress…
After we had made a board with the Modela we had forgotten our frustrations. Of course we mixed up inches and centimeters once, measuring the X in inches and the Y in centimeters. Surprise! The Modela just followed orders and didn’t think itself…so we had another mistake added to our formidable list of mistakes. But this is learning!

We had a board, although it was still on the bigger copper plate, not cut out, this was proving difficult for the combination Modela-myPerson-FABLAB Amsterdam. Other students had the same problem, so we decided it was the MODELA….. πŸ™‚ ……Blaming others is so easy!

Indeed it was our mistake! We lowered the head too much, so the Modela could not get deep enough to mill out the board.

But the board on the copper plate was ok for this test, since I could use the surface making notes on the ports etc.

Soldering went well! (When things go well, there is nothing to tell, that is our way of thinking…)

Then trying to transfer the program. Alex helped us with a great link:

which only lacks an image ( …I am an visually inclined artist…), so I thought one cable was enough to program the chip. It wasn’t of course. I was suspicious, because i noticed the two connections pins. (I should learn to read more carefully!)

this is a picture of my board, including the pins, and the two connecting cables, I added the MOSI MISO because I cannot stand not having an idea of what is happening, I looked up the ports in the datasheet pdf of the ATtiny45:

Then the difference in parts between Europe and California tricked me in a roundabout way of working.

First the parts: these connectors with shifted pins….! If you dont have the right male-female combination…you have to use dirty tricks…

I did! And also: i have a laptop running two OS: XP and MACOS. I have to prepare al my stuff already in these two OS, so I didn’t install Linux. And my laptop has no parallel nor serial port!

There you are!

Either go to the FABLAB every time for every part and programming, or…DIY.

I am DIY!

Luckily I bought a USB Serial converter this summer. Great chance to put this to use. Took a little while to get the driver. The MACOS driver was not up to date with my MACOS, so I had to do it on XP:

(around 5 dollar at

In a program called 232ANALIZER I could connect to a port. Then connecting pins 2 and 3 of the serial connector I could see it worked, sending back what I sent in.

Then I had to make the cables. Not able to use the parallel port I had to use my programmer AVRISP mkII, in combination with AVR STUDIO.

I already programmed a ATtiny2313 on a breadboard, so making the several connecting cables took me a few houres (checking and double checking) but then the ATtiny45 on the board could be programmed.

First I was stealing power form the USB port, but this didn’t prove enough for the progammer – chip combination, or the circuit was consuming energy. So I used a slightly more powerful pack of batteries and the programming went well.

Later on I programmed again, using the Serial port (converted from USB).

In 232ANALIZER there was clear evidence that the chip was sending, but the data were nonsense. Fiddling with the setting make me set the party to NONE and then the hello world text appeared.

This is nonsense, but with parity “none” this becomes:

“hello world”….isn’t this amazing????? πŸ™‚

Next step will be cleaning the process: making more boards, and possibly re-programming the chips.


  • you can do it with a modern laptop (of course)
  • it can be done with XP (of course)
  • it can be done with the most simple pins (of course)
  • the beautiful design of Neil’s board is wrecked (sorry: methods will be improved)

What did I learn:

  • making PCB’s using the MODELA: great!
  • using the USB to Serial Converter for communication
  • some Linux, I have to install LINUX somewhere…but YIKES, maintaining three OS’s!!!

What did go wrong:

  • handling the MODELA
  • handling Linux, old computer with serial and parallel ports…
  • i have to understand a bit what I am doing, otherwise i get frustrated, so luckily i understood a bit about the chip

Who/What helped me a lot:

  • Alex in FABLAB with links and his experience
  • my former projects in programming AVR chips, handling the programmer, (knowing about fuses!)
  • my former experience in soldering, and knowing about the parts, resistors etc
  • having wires, some pins etc in my studio, so being able to work independent from the tools in the lab: DIY for ever!
  • having bought the usb2serial converter this summer and having it available

Later on I discovered another great link: (ooops on my XP side of this laptop…)

What can be done: making my own PCB’s, needed because I have to deliver an RFID module. The chip is ready, but I have to design the right PCB (pentagon shape). Going on cutting circuitry with the vinyl-cutter.

PCB making: Modela troubles 1

In Amsterdam we did a lab-session for learning how to handle the Modela for making PCB’s.

All went wrong!

First a new computer was installed with UBUNTU but it took linux experts 1.5 houres to NOT get the USB port speaking to the Modela.

Then Alex recovered the slow old computer with a serial port. This thing worked, although we had to repeat the phrase “This thing goes very slow indeed!” every time we tried milling another board.

Yes every time because we didn’t really get one done decently.

The first went well, but the outline failed to cut out through the board.
The second one went wrong because we wanted to be conscious of environment and not wasting material, so we tried to do several on one copper plate, but the base was not really horizontal, so the corner gave us a tilted version of the engraving, see image.

Then slowly the screws for the millers became stressed…and we could not really fasten them properly.

Then we did the last one, wanted to mill it out with the outline, but we forgot that we were doing economically in the corner, it cut the thing out in the middle.

So all ended in tragedy (for us) and comedy for the reader of this blog….
We will try again!

ok, but only not deep enough!
a tilted version and one waiting to be cut out
ok, but the outline was on a different spot , right? Maybe the one in the corner is still usable….

we still pamper our dreams of milling perfect PCB’s, and indeed, making 5 sided PCB’s, to be fitted to a very intelligent chair….


PS, and as if this wasn’t enough: when the protecting layer gets loose you get this:

Most of the problems were caused by the lowering of the head of the Modela: it was lowered soo deep that the Modela had no space left to mill out the board. It took some time to realize this was the cause of our failures.