Studio Contrechoc

design & textile & technology entries

Category Archives: hardware

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:


Cuvée 2015: e-textile exhibition 2015 at Les Moulins de Paillard.

At the 2015 e-textile exhibition at Les Moulins de Paillard during the e-textile summercamp 2015 there was a big diversity of exhibited e-textile inventions. Curators of this exhibition were Anja Hertenberger, Irene Posch and Ingo Randolf.

Invitation card:


Some pictures of the exhibition space:


Other participants of the e-textile summercamp at Poncé sur le Loir suddenly called “Victory over the Sun”, differently: “Little sister” – in French “ma soeur” – ……ok … At the vernissage the game between you and the Sun inside this exhibit was explained in both English and French.

The pun of little sister: that generating energy is more easy than getting rid of energy was well understood using the metaphor of ourselves: eating too much is easy, but getting rid of the gained kilo’s is much more difficult!

The last Volt of the supercaps is like the last kilo. Even a plain short circuit will take a long time to dissipate this energy. After opening the circuit again, the voltage simply restores itself…this is apparently an sensitive area where theory (short circuit means 0V) and practice (used materials and chemistry) don’t converge.

At the exhibition solar cells and hand crank devices were added at a table near the silhouet.


For the exhibition, lasting a week, a special presentation mode was developed. The room was rather dark, which was good for showing the discharging LED’s at the back. But the Sun could never participate. And also, the current hand crank dynamo is too fragile for a big audience.

In presentation mode the dress was charging itself using a TIP122. Aha! – As you already remarked … this was not the right transistor, being NPN. Because for charging the supercaps, being connected to the GND of the microcontroller side, the same GND is connected to both the Collector and the Emittor…

This glitch occured because the presentation mode was added at hoc and of course at the last moment. In this case of charging the supercaps, the transistor should have been PNP, not NPN. Somehow, by using two different adaptors, the common GND could be fooled and the presentation mode worked also with the TIP122. But this TIP122 (NPN) will be soon replaced by the right kind TIP125 (PNP).




Discharging Victory over the Sun

Experimenting with the possibilities of Victory over the Sun, an unexpected paradox presented itself: gathering energy is not too dificult, but getting rid of this energy (for starting a new game) is not simple.

In the test version with a supercap of 1F a simple short cut was used. But in version 2 with a double supercap of 10F this seemed throwing away a lot of energy. And since the energy is the theme of this silhouet, just throwing it away seems not right.

So looking around for ways to use this energy the first idea was feeding it back into the lipo. But charging a lipo is a slow process. You don’t want to wait too long to start a new game. And also charging the battery that is running the system is … probably asking for problems.

Discharging by powering a ventilator is possible but making wind is not fitting in this silhouet. So the LED’s of the hacked Ljusa were chosen. The back of the silhouet already had lasercutted patterns. Inserting the LED’s and using a aluminum foil to make an inside reflecting surface gives a nice reward for all the work during the game. Since the supercaps are discharging the light effect are dimming. Because not only Ljusa bright LED’s were used but also red bicycle LED’s the light effect change because of the voltage drop.

The voltage drops from 5V to … 1V, so a MCP1702-3002 voltage regulator was used, limiting the voltage for the LED’s to 3V. This MCP is better than the voltage delimiter LD33V because this last one takes about 1V for itself, which makes discharging the low volts even more difficult.

Getting rid of the last volts is not solved yet. Discharging properly is not as easy as harvesting energy.


Light effect after winning the game.




Presentation Version of Victory over the Sun

During the coming e-textile summercamp there will be an exhibition displaying work of all the participants. For the Victory over the Sun project, a game on a wearable between a hand crank and a solar cell this means making a special presentation version, because the exhibition will be displayed in a closed space. No sunlight to play the game.

In fact wearable projects always needs one or several presentation versions.

The two lines of LED’s on the front will be all lit. Normally only two LED’s are indicating the current game situation. From time to time there will be a simulated game between left and right (hand crank and solar cell). That way the silhouet will be “alive” and showing its potential even without players.

vs1   front   vs7    back (if discharging)

The electronics in the perspex casings at the left side will be lit by special bright LED’s, white, inside a kind of small shade. From the top of theperspex the lasercutted text will be nicely visible. The “scary” electronics will be a bit in the dark.

vs2    vs3 right side

In preparation is the next version in this project. Flexible solar cells will be used bent over the shoulders. These cells produce 1.5V each, and the game needs 5V, so another LTC3105 will be inserted. This chip boosts the voltage to 5V and can keep the most efficient load value (MPPT).

The cells of this newest version will be on display too:


The flexible solar cells can be bend to the shape of the shoulders. The LTC chip delivers 5.2V even when the Sun is weak. Compare this to the first version:


The big LED’s are nice but the light is invisible in the Sun. But of course in the latest version the bright LED’s are blinding inside.

Teensy 3.0, BlueSMiRF and Mindwave

In the last post the Serial and SoftWareSerial of the Arduino and Coolterm and the UART of the BlueSMiRF were performing some acrobatics, but it is all possible.


After buying a Teensy LC and Teensy 3.0 this acrobatics was made much more simpler using the possibilities of combining USBSerial and Serial1. On the Teensy 3 Serial Ports are available.

With the Teensy the BlueSMiRF is connected to a Serial Port and the data can be seen in a Serial Window:

Screen Shot 2015-05-12 at 09.02.17

And because this project involves servo motors, it is nice the Teensy has so many PWM Pins and Timers!

The basic Arduino BlueSMiRF test script can be found here:

You can find how to configure the BlueSMiRF for connecting to the Mindwave here:—hacking-mindwave-mobile

The Teensy page on Serial UART:




Bluetooth boards and the Neurosky Mindwave

For some project the Mindwave Neurosky with bluetooth was interesting. Jostie quickly made an Android App, which could connect to the Mindwave during the 2015 NASA App Challenge weekend in our neural network attempt:


His app can be found here:

bt9 From Mindflex, with Serial to Mindwave Mobile with bluetooth

But we wanted the signals directly available for a wearable. For this a bluetooth board was needed, which could connect to the Mindwave. Several options were available.

By studying two tutorials constraints for this setup are becoming clear:

  • The board has to have the possiblity to behave as a master, connecting to the Mindwave.
  • The communication has to be Serial (that is fast) and not SoftWareSerial (two reasons for this!)


We tried different boards (although we could have guessed that only the boards mentioned in the tutorials would function 🙂 —stubborn!—

bt3  older BT board, old – hard – school – command coding RX-TX connection

Easy Bluetooth ( not for sale anymore?)
This is an “older” board, from a few years ago. No problem connecting and using as a slave. There is more: In this pdf of 100 pages you can see that you can enter the command mode, and make this board a master. But … this is the real stuff in command BT-coding, will cost some time to study.

bt5 see the wires: SPI connection: 6 besides the V and GND

Bluefruit LE – Bluetooth Low Energy (BLE 4.0) – nRF8001 Breakout (

A recent board. Communicating easily with an app, sending to a wearable. This board is easy to connect to, but functions as a slave. So for our purpose this board cannot be used. Besides, compared to the other boards, the SPI connection has a lot of wires…

The documentation from Nordic is also extensive:…/2981/…/nRF8001_PS_v1.3.pdf .

bt4 very nice, “designed” connection at the FTDI of this RF12 board

Bluefruit EZ-Link – Bluetooth Serial Link & Arduino Programmer – v1.3 (

This is a board with some nice possibilities as can be discovered here:

It can be connected to the FTDI header of a Jeenode, making the Jeenode having both the RF12 and bluetooth wirless.

The board has an optional JST connection. So you can make a standalone module witha lipo attached. Only problem: the lipo in the JST connector is always on: no on-off switch. So in practice this connector requires soldering a switch in the wiring to the lipo, which is not fun.

But as can be read in the FAQ of Adafruit:
Can EZ-Link act as a BT ‘master’?
No, it is a client-mode only device.

End of story for our purposes.

bt1 without the BEE carrier, programming with the AVR SPI mkII

Bluetooth Bee – Standalone ( )

This board has a bluetooth part combined with a ATmega168P (Not an ATmega168 as told in the wiki).

The wiki can be found here:

Getting this board working did cost more time. Using an AVR ISP mkII programmer (not the X Bee carrier) was the first hurdle. After a while the J1 connector functioned – or the configuration was understood.. Uploading code was possible after adding the ATmega168P code to the Arduino boards.txt file, using the shift-U command in the Arduino environment.

Screen Shot 2015-05-07 at 09.54.15 Screen Shot 2015-05-07 at 09.55.27

(Our AVR ISP mkII is hacked so that it provides either 5V or 3.3V directly to the board – this one needs 3.3V.)

The LED’s (red-blue) on the BT board code as follows (no the description in the wiki): Master mode: double fast blue: not connected, single blue: connected. Waiting to pair: red, blue alternating.

If paired right from the laptop you get a BT – Serial link in the Arduino environment. Opening this as a serial monitor initiates the pairing, the key “0000” is given automatically. The board is in slave mode. The example code worked, the led could be lit and “shut”.

Screen Shot 2015-05-07 at 09.55.02

But the master mode is needed.

At this page about the Bluetooth Bee you can find the commands :

The code used to get the master mode using the commands can be in the scripts at github:

The communication is done using SoftwareSerial. On this board communication is hard wired using pin’s 2 and 3. See the schematics at:

This hard wired connection is the problem for our project. For the Mindwave to give signales regularly a faster connection is needed than the SoftWareSerial can provide—the “normal” Serial connection on pin 0,1 is much faster—, as will be seen in the last bluetooth board which is tried out. The signales are coming through with SoftWareSerial, but apparently there are so many bits falling out that sometimes you have to wait seconds or even 10’s of seconds for new values of the Mindwave.

The script using this Bee Standalone board can be found here: (mind the baudrate which is set at 57600, default 38400 – start using this value to set the baudrate at 57600). It functions, the LED signals received values from the Mindwave, but not too often and at irregular intervals.

The second problem for our project is also related to using SoftwareSerial. We want to transfer the values from the Mindwave to servomotors. But the Servo lib and the SoftWareSerial lib are incompatible (probably they use the same timer).

So also this board is not what we needed.

Nice post in Japanese:,

bt2 nice and clean, connected to an ATmega328 board with RF12

 BlueSMiRF Silver (

This board was mentioned in both the relevant tutorials. So no wonder that this board functions. Using the command mode it can be programmed in Master mode and the MAC address of the Mindwave can be entered. Connection and reconnection is done automatically.

In our project we spent time using the SoftWareSerial instead of the Serial port, with the intention of debugging. The speed difference resulted in dataloss (apparently) and only some packages of the Mindwave were received in minutes. With the Serial, pin 0,1, Mindwave values enter once or even twice a second.

SoftWareSerial was used to communicate with Coolterm (or other Serial monitor) to see what was happening and debugging. This interfered with the servo motor lib.

The ATmega328 board (Jeenode) with the RF12 provided a solution: bluetooth signals from the Mindwave are received using the UART of the Smirf, then the signals can be transmitted using the RF12 transceiver. These signals can be received in a similar board.

Scripts using the Mindwave and this board can be found at:

The projects with these boards and scripts will be presentated later…


Victory over the Sun: technical testing

The dress described in former posts was finished finally.

The dress as a result of an artistic research into energy harvesting and design is presenting a game situation. By rotating a dynamo you have to compete with the Sun and a solar panel in generating energy. The game is created in a wearable so that you can change to another location. Playing the game in different locations makes you aware of the power of the Sun’s energy in comparison to your own muscle energy.

The dress is very much a prototype. As can be seen from the electronics a large amount of testing is needed to make some sort of a playable game.

The electronics was fitted inside 4 acrylic casings:


dynamo charger, supercaps/lipo, the brains: 2 ATtiny85’s and bitshifters, and an LTC3105 energy harvesting chip.

then fitted to the side of the dress: (which makes us aware that we should have thought of a better wiring 🙂


Up left: the charging dynamo, up right, the ATtiny85’s, and the bit shifters, down left, the supercaps, and lipo, then bottom right, the LTC3105 for recharging the discharged energy into the lipo.

After fitting the casings will be covered with small pieces of jeans, only the dynamo charger will be visible.


Two out of the three casings covered.

The choice for 2 ATtiny85’s was made from the first version where we had only 4 LED’s for the two sources of energy. But now after making it all we realized that the 2 ATtiny85 with the bit shifters should have been replaced by one ATmega328, with a LED-block script, avoiding the bit shifters. This would have saved one casing. This will be done in the next (third) version of the electronics.


Besides the solar panel a battery pack is installed to make testing in a room without the Sun easier, you can test by switching to battery pack (right side, next to the solar panel). The wiring between all the casings and groups of electronics is done by female – male connectors. This makes testing easier.


The second version of the script discharged the supercaps after winning. Winning is reaching the 5V mark. But what about starting a new game after abandoning a game half way? It was decided to discharge the supercaps at the start, when you switch on. Discharging is not what is seems. Following the voltage of the supercaps to about 0V, you see the voltage rise again without any charging. So discharging is now done in steps, then some delay, then measure the voltage again, if it is above a limit, discharge another round and so on.

This repeated discharging worked…until the dress was put in the full sun. The solar panel is generating so much energy that the discharging is not fully obtained. The discharging time had to be made bigger.

The installed solar panel is doing 0.1V a second so it will win in 50 seconds if the Sun is not hindered by clouds. At the moment it is practically impossible to win this using this hand crank dynamo hacked from the Ljusa.

Besides that, as could have been expected 🙂 the big LED’s are not visibly on or off in the full Sun. Another interface should be added, or these LED’s like this removed and giving it a try with small superbright LED’s.

A movie of the solar panel racing towards the 5V:

After observing the problem of the LED’s not visibly lit in sunlight, we tested bright LED’s in a simple script at 3V:

So the big 10mm LED’s will be replaced by these 3mm bright LED’s.

2015 NASA App Challenge

Two years ago we participated with friends in the 2013 NASA App Challenge with a wearable. Last year we did a game for the 2014 App Challenge. Now we do another wearable challenge in the 2015 NASA App Challenge:

This is the first time we really try to make “intelligent” garments. We will integrate a neural network in the wearable. This network will “learn” by trying to recognize patterns. This learning will be made visible by changing the shape of the wearable, or even morphing.

The neural network will be small, and the learning capacities will be very limited, but this is a start at “really (somehow) smart” fashion.

Details about this project can be found in this hackpad:

images will follow next week when we try to finish two wearables in one weekend, where normally it takes about a month for a wearable…

But now we come with a group of expert programmers, designers and e-textilers, together with a car full of equipment…

(Making tags for this post … nearly all tags created for this blog are indicated, which means that something will be happening!)

Project page:

Je suis – project

From the “Je suis Charlie” quick hack ( after quite a lot of modifications, this post provides some documentation of the “Je suis” project.

The project name has changed from “Je suis Charlie” to “Je suis”. In the idea of defending our “sacred” European civilization by joining in with the public outcry around the events in Paris this Januari there are too many issues – if you think about it.

Engagement is tempting but in the end individuality and doubt get the upper hand. Do we defend our freedom of speech and cartoons by necessarily offending others? On the other hand do some killer madmans – probably with some brain defects – defend their civilization by taking a gun and shooting around? Neither seems likely.


Therefore the essential “Je suis” is retained. This is an enormous shift in meaning!

Not the “I am because I think”, just the “I am”. Whatever that “I” is – whatever “being” is. Thinking closely to a text always dissolves the meaning. Individuality, supposedly developed during what we call the Renaissance is diminished paradoxically by all the “sharing” and copy pasting of the Web 2.0 and “social media” anyway.

Back to the project.

Temporarily showing “Je suis” is funny because this is the way thinking about individuality or the “I” works. Most of the time you just don’t think about it, sometimes it pops up. This voice inside our head, is it the “I”? And even when it is, why does it think it is different from  “the others”. Better? Worse? If the “I” pops up, it is only confusion. You seem to be “a thinker” if you state a blunt theory about this confusion, like “I think therefore I am” or “Sein und Zeit”. But how can just one voice inside a brain superimpose a static local idea on this evolving humanity of milliards of other voices?

The shift in meaning retained the idea of “content”, which is lacking most of the time in wearables. Combining design and interaction is already difficult enough!

So the “Je suis Charlie” flat 3D prints were replaced by “Je suis” 3D prints. In the middle the two hands, reference to the hands of Michelangelo…but in an 8 bit version! Which seems appropriate for our primitive understanding of the “I” and being.

The cord and the clips were discarded. The clips provided weight, needed for getting the plates down again. With just a cord the plates where not pulled down. The solution was to use a string of beads. This necklace is also a “normal” accessoire used in combination with this type of dress.

To pull the plates up, some mechanical problems ad to be solved. The part had to be attached to the dress to give it a rotation point – there was a black slip providing for the necessary frimness under the fragile upper layer of this party dress. And there had to be some distance from the end of the plate that is to be lifted to get an “arm” to work with. This was done with a small part 3D printed:

Screen Shot 2015-03-22 at 16.04.29

The angle to the horizontal and the grip on the beads of the neacklace proved essential for a proper lifting.

At the back the electronic was fitted to an acrylic transarent plate with two holders over the shoulders: (this part will be renewed by a shape done with the lasercutter)

2015-03-22 15.28.28

The electronics remained the same, there is a distance sensor which triggers lift of the plates by a stepper motor at the back. For presentations there is a special button for immediate action.

The beads were making the lifting a big job for the steppermotor, so the voltage for this motor was increased to 7.5V, two lipo’s in series. The AT328 is protected by a 3.3V Voltage regulator.

Most of the wearables hide the electronics. In this project about “je suis” it seems right to show the electronics, although on the back. You can watch the stepper motor pull physically at a cord to reveal the “content”.

A small demo movie sketch can be found here:

2015-03-22 14.48.02

Victory over the Sun – (sketch version)

(see for a more advanced version)

This wearable is part of a research into energy harvesting, which can be found here: (Slow Raspberry pi server!)
The purpose of this wearable is to compare two sources of energy, not just showing a charging wearable.

The title of this project has changed a few times:

  • 1. Not another solar dress
  • 2. Energy battle dress
  • 3. Victory over the Sun

The first title is indicating that this project is not another mobile phone charging wearable. There is a solar panel, but also a hand crank device in the dress. But it is not about charging anything, because charging from a wearable is anyhow not very efficient.

The second title is indicating that the purpose of this wearable is comparing two sources of energy together in a game. The two source compete against each other. Which one will win? The solar energy or the muscular energy?

The third title is a reference to the oper of the Russian avant garde in the Bauhaus time:
Malevich and El Lissitzky made this oper famous, contributing to the stage design and the graphical displays.

There is some sarcasm in this third title, because it is rather impossible to win from the Sun in this game, only at night you have a chance, the solar panel is even charging slowly in normal daylight without direct sunlight.

Appropriately for the material old discarded jeans are chosen. Thus the material is recycled. The wearable is a simple dress with possibilities to add panels and the hacked Ljusa hand crank.

From the parts of jeans which were not totally worn out pieces were cut and these pieces were sewn together. An interesting folding problem popped up which will be described in another post.

Picture of the wearable in progress: (The hacked Ljusa, with the white card board and the red crank will be redesigned and more properly inserted into the wearable of course)

2015-03-12 07.51.57#1

Wearable made of recycled jeans material.

For the hand crank I have chosen the Ljusa of IKEA, which is a toy generating some power. It stores the power too in a 1.5F supercap. The second source of energy is a solar panel. Added to this is also a 1.5F supercap. With a ATtiny85 and 8 big LED’s – 4 LED’s for each energy source – the winning source can be made visible.

The electronics idea was to show the current Voltage for the two sources in two rows of 4 LED’s. The microcontroller which can just be used is a ATtiny85. Two analog PIN’s and two PIN’s for a multiplexer chip. One PIN is left for one other purpose.

Although the sources are generating energy, there has to be another energy source for the microcontroller at the moment. It would be an nice idea to have the sources (solar and muscle) first generate enough energy for the game to start, but this has to be figured out yet.

The third energy source is a rechargeable lipo battery.
Then there has to be a discharge for the game to restart. This is done using a FRT5 DC5 relay.

The number of difficulties in the electronics were plenty: besides the usual stupid mistakes like connected the LED’s the wrong way there were a few real “Zen master” problems (which means you have to learn something besides correcting stupid mistakes).

The ATtiny85 uses USI instead of SPI, code for this was found at:

Then the implementation of the use of the analog PIN’s proved time consuming. In the end the soution was found in connecting the PIN’s to the GND using a 1M Ohm resistor.

Then the coding of the LED’s, in two groups of 4 inside the bigger group of 8 was proving not straightforward. Apparently the number read using the ADC code is not a “normal” INT number and you cannot use all math available, like subtracting 512 from the value read between 0 and 1024.

The final code can be found here:

Testing pictures of the electronics:
Testing is better down as much as possible outside the wearable. In the end the electronics is on the board and the ATtiny85 had to be removed and placed in the programmer breadboard way too often again, I could have better soldered programming the wires to the board right away…

  • testing first the ATtiny85 and multiplexer on a breadboard
  • testing the LED’s on a piece of jeans
  • the PCB with the supercap, multiplexer, relais and ATtiny85

2015-03-16 08.09.00 2015-03-16 11.18.50

2015-03-17 10.38.49

Remarks about the PCB:

  • One relais too much, two components right upper side FRT5!
  • At the left side the two energy sources can be connected.
  • The green component is the 1.0F 5.5V supercap
  • The Ljusa has it’s own supercap (storing energy), the solar panel uses the supercap (green thing) on the board.
  • Middle under, ATtiny85, left under hd74ls164p shift register
  • The PCB can be redesigned more efficiently!