Detecting buttsex

You will recall that in my initial sensing application I failed to check to see if I could detect buttsex. Well, I am pleased to report that I have progressed somewhat from that! It took a while for me to work up the nerve, because my mold is a little thick and it’s been a while, if you know what I mean.

Anyway, science and a little boredom gave me the opportunity to test the insertable toy with all three gestures I wanted to detect.

You may recall that a hand job is quite unique with very clear signals from all of the sensors:

Hand job raw sensing data.

What is especially unique about the hand job is typically the hand can’t stimulate the entire shaft when it’s fully “in” this results in the tip of the toy poking out of your hand. Even if you had a particularly large hand, i would hazard that because of the shape of your hand, the tip would still lose stimulus at the peak of the “in” stroke.

A blow job is similar except that the tip gets stimulated in varied and complex ways when it enters the mouth, likely due to saliva. Also, I personally wasn’t about to uniformly stimulate the base of the shaft with my mouth alone.

Raw sensing data during a blow job.

Finally, the data you have all been waiting for. Insertion into the butt looks like so:

Raw data sensing in the butt.

Note that it’s a very different story to the previous two data sets. the tip is stimulated on entry and is essentially always stimulated throughout. This is even when I withdrew it as far as I dared. I think this is because even when it’s no longer inserted, your body is still close enough to the device to act as a capacitive body, even without direct contact or pressure.

With the above data I was able to crudely detect the difference between a hand job and butt stuff using the DTW algorithm “most of the time”. Evidence suggests I will need to improve my normalisation algorithm because in cases where a dataset is “flat” (e.g. as in the butt stuff), the normalisation tends to unnecessarily amplify noise, which can result in false positives. I also suspect that the 8 point moving average might be a little too aggressive.

Detecting cum with voltammetry

After my little stint of research, I set about putting the theory into practice. Before I go into it, here is a video of detection working (warning, contains bodily fluids).

Warning, this video contains bodily fluids.

Fluids in order: water, lube, salt water, urine, semen.

My laptop keyboard still has suspicious fluids on it…

Please note the above video is a best case scenario and a lot of testing is still required!

My first attempt was to just pass 5v into various samples and see what they did. I used the #2 digital output pin on the Arduino to control whether or not any power was sent to the sample and a 10 kΩ shunt resistor so I could measure the current across the sample by reading the A0 analog in for the Arduino. I measured the current once every 10 ms for 2 seconds, then rested the sample for 2 seconds.

The results were encouraging.

The graph below shows one round of stimulation of a sample of water, the orange line represents voltage in (5v) and the blue line is the current measurement. You can see I rest the sample between trials for 2 seconds (important).

Change in current over time when sending 5v through water.

The following shows the change in current measured in a sample of cum.

Change in current over time when sending 5v through cum.

So, there’s definitely something happening, the current across the sample is changing for the duration of the stimulation (2 seconds), but how to get a more meaningful comparison? I knew that I needed at least 1.23 v to electrolise water into into oxygen and hydrogen, but I didn’t want to use much more than that. I used a simple voltage divider made from two 22 k Ω resistors, resulting in something close to 1.8 v across the sample, which seemed to work OK.

Apologies to electrical engineers who are offended by my poor diagram.

After taking many samples and calculating an average for each sample, I could say with confidence that on average, a 2 second stimulation of the various samples looks like this:

Average change in current over time for different samples.

Now, it looks pretty cut & dry: cum has on average a much much lower final current after 2 seconds. Why not just measure the current value after 2 seconds of stimulation and if it’s below a threshold (say 35 in the example above), then it’s cum? Well, the problem is that this is an average, the real data is a whole lot messier:

Change in current over time, just for the cum sample. There’s a wide variety of data points.
Change in current over time for the urine sample only.

The fact that cum has a very distinctive “shape” on the average graph gave me the encouragement to try harder to untangle signal from the noise.

To overcome the variability in the data I did two things: firstly I took a 5 point moving average for all points, to smooth them out a little. I then expressed every set of 5 points as a ratio of the first 5 points. So, to get the value for point 8, I would calculate Average(Points(8-12))/Average(Points(1-5)), which is actually the same as Sum(Points(8-12))/Sum(Points(1-5)).

This resulted in the following graph (once again, taken as an average):

Ratio of the 5 point moving average to the first 5 point moving average.

That’s all very well, but this is still an average, how do we handle the fact that each trial (each time I stimulate a sample) may have variability to it? Looking at the minimum and maximums rather than the averages, we get this:

Minimum and Maximum current ratios.

If you look carefully, you can see at about 10 or 15 (between 100 and 150 ms), there’s a promising gap between all other minimums and the maximum value for cum. I focused my attention on this ratio.

So, that’s it right? If the ratio between the first 5 points and points 10-15 is less than 0.8, we have cum! Well, yes and no. As I said before, by passing a current through the sample, we are actually changing it, so we need to consider how the nature of the sample changes over time. Also, I wanted to speed up the time taken to get a result, up until now, I was stimulating for 2 seconds and resting for 2 seconds, that was quite slow for the detection I wanted.

So, I sped it up, this time allowing the sample to rest only 100 ms and stimulating for only 200. I then recorded the ratio and plotted it over time. So, the graph below is showing many hundreds of trials (a cycle of stimulation and rest for the sample), where the x-axis is the trial number.

Fast sampling over time

Saliva appears to be quite unstable over time. All other samples I used appear to stabilise well above the ratio for cum. Saliva, however, comes dangerously close. To be fair, I don’t mind so much if I get false positives on saliva since I am not expecting saliva to find it’s way inside the masturbator toy.

I am still worried that the samples do change a fair bit over time, making stable readings difficult. I also note that my simple copper electrodes may not be good enough. The positive electrode slowly builds up a black layer of oxidation, probably from the electrolysis.

Simple code for the detector is here: voltammetry2.sdf.ino

Approaches for detecting cum

It’s been referred to as the “holy grail” of teledildonics, and in my hubris, I want to have a go at detecting male ejaculation. Why ejaculation? Well, this is specifically for uses where someone is playing with a male masturbator toy and they climax. Wouldn’t it be great if they got some kind of feedback for their effort? Maybe the game gives them a reward or the content changes somewhat. Without detecting their climax, there’s no way for the system to do so.

Such a detector would need to be:

  • Affordable (let’s say, less than $50 per sensor)
  • Safe (don’t want to give them a nasty shock or chemical burn as they cum)
  • No false negatives (would be disappointing even if it failed to work just once)
  • No false positives for other common fluids (lube, urine, pre-cum, saliva, water and sweat)
  • Nearly immediate – no point in recognising cum some minutes after the event!
  • Robust against environmental factors (like humidity or what they had for dinner)

I set about researching a number of techniques which I thought would bear fruit:

Florescence: The first thought one might have is to do what they do in the movies and use “black light” or UV. From reading this post on the florescence of semen, it turns out that you need Luminol to trigger semen’s fluorescence with UV, though it sill fluoresce under blue light. Besides all that, these fluorescence based tests only appear to work on dry semen, not liquid semen. This fails the “immediate” test.

pH: At between 7 and 8 on the pH scale, semen is slightly basic, but not enough that using a pH sensor is going to give you a distinguishing marker verus, say, tap water. Also, this pH would probably can vary from person to person. Finally, the pH sensors I have seen are rather bulky.

Spectral Analysis: From semen’s spectral response it looks like the 1650 cm-1 wave number range is good for detecting cum. Detection works this way because certain organic compounds in semen vibrate at a certain frequency. These compounds are found in many other organic samples. The problem with this approach is, this frequency is in the mid-range IR, which is very expensive to produce and detect since it’s so close to heat. It would require expensive specialised apparatus to do it this way and it would most likely both destroy the sample and possibly burn your penis in the process.

Resistance: I tried measuring the resistance of cum using various approaches, but just when I thought I understood how it related to other fluids, I got different readings. Besides which, urine (at approximately  70k ohms) is quite a good conductor compared to cum (about 700k ohms).

Electro-chemical: After reading this paper about detecting chemicals. It made sense to me that whatever technique is used to detect glucose in blood or specific ions in solution should be able to work with cum, because I knew cum contained some salts, in particular sodium and potassium ions (see Biochemistry of semen and the Wikipedia page for semen). We were finally getting somewhere!

Voltammetry: A technique known as Voltammetry, passes a known voltage through a sample and observes how the current through the sample changes over time. This recognises the fact that the act of passing a current through a solution will perform some kind of electrolysis on the solution.

Finally, the phenomenon where semen’s resistance changed over time made sense! You see, whenever you pass a current (no matter how small) through a sample such as semen, you are going to change its chemical composition somewhat. We can measure that change by measuring a change in current.

Next, I actually implement a voltammetric apparatus for detecting cum.

Insertable Speed Detection the Easy Way

So, I have gesture detection working relatively well, the next hurdle is speed of the gesture. It sounds like a relatively simple problem to solve, but it’s deceptively complex, especially since we’re dealing with a series of data points.

In the video above, I am using a simple moving average on stream 3 of the input. Whenever the current data point drops below the moving average, that’s considered an “out”, when it drops above, that’s considered an “in”, the result is data that looks something like this:

Every time the blue line crosses the yellow line, we count a “tick”. Speed is the number of ticks in the last 16 samples.

Whenever the data value crosses the moving average in any direction, I consider that a “tick”. I then count the number of ticks in the last n samples to get an average speed during those samples.

It works surprisingly well, you could increase the number of samples to get a smoother speed calculation, but I think a responsive value is better. I am currently summing across 16 ticks.

In theory, a Fast Fourier Transform should be able to give me the frequency of the signal I am recording and that frequency could be used to approximate speed of the “hand job” gesture. In practice, I think the moving average approach is relatively computationally cheap as well as robust.

Insertable gesture detection using DTW

I am pleased to report that the stream of data I have been collecting off the insertable device can be used to detect different user gestures. Gestures you ask? Well, I want to be able to tell what the user is doing with the device (e.g. blowjob, licking, hand job and penetrative buttsex). Not sure if I can tell the difference between a vagina and a butt, but why not try?

The video below shows the device distinguishing between blow jobs and hand jobs.

The detection algorithm is taken from the excellent Kinect DTW implementation.

Dynamic Time Warping (or DTW) is a great little solution for matching time-series data where the data points might be stretched or squashed over time. Apart from detecting blow jobs it has been used for speech recognition among other things.

I retrieve the stream of 8 data points from the device, let’s call a collection of these 8 data points a set. I get a set every 100 ms. When I have more than 8 sets of data, I attempt to match those 8 sets of 8 data points to a prerecorded “example” sequence of 32 sets in memory using the Dynamic Time Warping algorithm.

The image below is an example sequence of a “hand job” gesture:

Template sequence used to determine if a gesture is a hand job.

Because lube and other environmental factors can change the baseline considerably, I “normalise” the data to a value from 0 to 1 for each independent stream (line) of data. This seems to be a pretty robust approach.

Template sequence normalised to remove bias due to environmental factors. .

Normalising in this way is helpful, especially if you consider that the conductive silicone will also have a capacitance and due to my imperfect construction process, I can’t guarantee this will be consistent in any way.

A last step (which I haven’t yet tried but will shortly) is to apply a simple moving average to smooth the data out. This should result in more reliable matches.

The normalised sequence is smoothed to allow for more reliable detection.

I have been able to get this same algorithm working in C# as well as Renpy, a Python based gaming engine I intend to use for a game that interacts with the device. Unfortunately Renpy is a little too slow for the processing and is not really designed for this kind of real-time processing anyway.

Next step: move the gesture recognition processing onto the arduino itself for performance reasons. Turns out there’s not enough memory to implement a DTW algorithm for more than one gesture on an arduino. Never mind, I learnt how to do threads in Renpy instead (renpy.invoke_in_thread).

Insertable toy prototype

So, here we are, the moment you have all been waiting for: behold a working prototype of an insertable toy.

After building up the layered conductive and non-conductive silicone per my insertable design, the next challenge was getting a negative mold of a penis. My penis to be precise, because I wanted the first prototype to be of my own wang!

I managed to make a 3D model of a fox using 32 still images.
I managed to make a 3D model of a fox using 32 still images.

Turns out it’s a lot harder than you think to make a clone of your penis. I investigated doing a 3D scan using photogammetry, which could have worked but it really requires a lot more of a “still” model as it were. I did, however, get this great 3D model of a plush fox by taking 32 still images and stitching them together in 3D using freely available software.

The negative penis mold life-cast with alginate.
The negative penis mold life-cast with alginate.

In the end, I bought one of those “clone a willy” kits. “Casting from life” as it’s called is usually done with alginate (the same stuff that’s used to make a mold of your teeth at the dentist). It’s body-safe, non-toxic and (unlike plaster of Paris) doesn’t heat up as it sets, but it also sets rather rapidly so you have to be quick. It’s also heavily reliant on water to keep its shape so you have to keep it well hydrated. I found that filling the negative mold with water and putting it in the fridge allowed it to last longer.

You have to get the temperature of the alginate correct (32 degrees C) whilst maintaining an erection, all within 2 minutes. It took a few goes, but I managed it (with a little help).

The sensing core for the insertable held together better than I expected.
The sensing core for the insertable held together better than I expected.

The other, most important part, was getting a protective layer of silicone around the sensing apparatus because I didn’t want little carbon fibres poking people in the butt. The sensing apparatus had now developed into a rather scary looking porcupine with 8 wires coming out of it, terminated by alligator clips.

Effectively what I am trying for is a process known as overmolding, where you mold a material over another to achieve the desired effect.

The silicone that came with the “Clone a willy” kit was a harder shore value than the silicone I already had, it was also much slower to cure. For this reason, when I poured it into the negative, it just pooled in the tip and didn’t really cover the sides as I hoped. So, I used my softer, faster curing silicone to coat the inside first, filled it with the (pink) harder silicone and then rammed the sensing apparatus down the center of the mold.

To be honest, I don’t think this is entirely the best approach and will need some re-thinking.

Once I hooked up the alligator clips to pins 4 through 11 on the MPR-121 shield, I was able to output tab separated values out onto the serial port. The Arduino software I am using conveniently converts those into a graph if you like.

The insertable test script is here. Note that I overwrote the initial voltage and threshold values in a bit of a brute-force manner because I didn’t want to mess with the existing cpp files that come with the MPR-121.

I get nice clean signals when I interact with ant part of the device, cleaner than I expected. My next challenge is interpreting all this data as “gestures”. I am thinking of getting information like % insertion, speed (rpm) and the kind of activity (e.g. touch, buttsex, handjob, blowjob, lick, squeeze, etc).

I think the dynamic time warp algorithm would be ideal for this kind of processing because not only could it match gesture curves without being time-based, the amount of “time warp” I get could tell me how fast the gesture is happening.

Of course, after I have done all this work, I discovered the concept of Swept Frequency Capacitive Sensing which could actually be the ultimate answer to my challenge.  I guess we’ll see how we go!

Next: See how I implemented the gesture recognition for the insertable toy.

Insertable Design

The insertable toy was the first one I thought of over a year ago. The original design involved wires and conductive paint to somehow create capacitive touch surfaces.

Original design for the insertable device.
Original design for the insertable device – Wrong!.

I knew that wouldn’t work, not least because the exposed wires were not going to be a smart idea in the butt. With the discovery of the conductive silicone I decided that maybe the best approach would be to pour layer after layer of conductive and non-conductive silicone into a negative mold of a penis but that just created more questions, namely: how do I get the wires connected to the conductive silicone in the first place?

Original design for an inner battery holder.
Original design for an inner battery holder – also wrong.

I thought about having a solid center with conductive pads on it for the shaft, the benefit of that approach would be that I could put batteries in it and such. Advice from my friends who have far more experience with toys of this nature quickly scrapped that idea, but not before I got a nice 3D model printed.

3D Molded core prototype
3D Molded core prototype

The design above and model to the right is of a 20mm diameter shaft with a 18mm hollow that could accept 2 AA batteries and go inside a toy. The consensus from my friends who have more experience with butt toys was that if you’re making a silicone toy, you may as well have as much of it silicone as possible.

It was as I was fiddling with some CAT 5 networking cable that I had the brilliant idea: hey, I could just stick this up your butt! The design changes from a 20 mm solid core to a flexible core about 9 mm in diameter, but how to make the layers of conductive and non conductive silicone.

The layered silicone design calls for a flexible core of cables with 10 mm of conductive silicone sandwiched between 20 mmm non conductive.
The layered silicone design calls for a flexible core of cables with 10 mm of conductive silicone sandwiched between 20 mmm non conductive silicone. – Better!

I had already determined that 5 – 10 mm of non conductive silicone would be a perfect protection from the conductive silicone whilst keeping the capacitance. 20 mm made sense then as the insulating distance between layers. What I needed then was a shaft that looked like this.

As you can see, I split the conductive silicone into two “hemispheres” to allow for more accurate sensing of what is going on.

This design allows for the creation of both conductive and non conductive silicone layers.
This mold design allows for the creation of both conductive and non conductive silicone layers. I call the left hand model the “O” the middle the “T” and the right is the “I”.

How then, do I get such accurate layers? Well one of my lessons from before is that silicone is best when worked additively. That is to say: adding more silicone to silicone is easy, taking it away is hard. I also learnt that pouring silicone in layers sucks.

I decided to use a mold which would allow me to create little cylinders of silicone which I could then glue together with more silicone. Behold the new design above/right. It’s made of three pieces: “O” on the left, “T” in the middle and “I” on the right.

These conductive hemispheres are 10 mm thick .
These conductive hemispheres are 10 mm thick .

The mechanical connections are very chunky and simple, which works best for 3D printed parts. the “T” shaped piece goes into the “O” cylinder mold first, allowing you to create the two hemispheres. I found that using cling wrap on top allowed me to get a “clean” finish to the top of the layers. Also note that the conductive silicone is pretty “hairy”. I cute those hairs off easily with a pair of scissors.

Once the two hemispheres are set, you replace the “T” with the “I”, which then leaves the negative space for the non-conductive silicone parts:

Completed conductive layers threaded over CAT 5.
Completed conductive layers threaded over CAT 5.

With the “I” piece in, the molds can also be used to make the non-conductive rings:

Making the non-conductive layers using the same process.
Making the non-conductive layers using the same process.

Putting it all together is relatively simple thanks to silicone’s ability to bond at a molecular level with other silicone. The “I” pieces were a convenient way to keep the pieces aligned so that they would set properly.

Connecting layers of conductive and non-conductive silicone.
Connecting layers of conductive and non-conductive silicone.
Splitting CAT 5 turned out to be a bad idea.
Splitting CAT 5 turned out to be a bad idea.

I tried cutting some CAT 5 cable so that I could insert that into the conductive layers, but that ended in disaster. My wire stripping skills and the need for accurate measurements meant that the wires just weren’t the right length, and I was never going to be able to stick them into the silicone with any degree of consistency, even after “tinning” the stranded wire with solder.

In the end, I used solid core wire rather than stranded wire. Solid wire sticks better into the conductive silicone anyway.

Click here to see the completed insertable prototype.

Things I learnt from this exercise:

  • It’s easier to cut small slivers of silicone with scissors
  • It’s easier to cut conductive silicone than non-conductive
  • Cling wrap is good for getting “clean” edges with silicone
  • You need something to keep the models aligned when gluing them together (in this case the “I” pieces)
  • CAT 5 cable is stranded wire so not best for sticking into silicone.

 

Masturbator first prototype

After designing the mold, it took a while for me to plan how I was going to actually use it to make my first prototype. Without further ado, this is the resulting  working model for the masturbator. Your peen goes in the scary looking cavity.

The completed model worked better than I expected although the silicone was too hard.
The completed prototype worked better than I expected although the silicone was too hard.

The only failure of the prototype was the silicone is too hard (shore A-10) whereas it should probably be 00-30, apart from that, it worked just as I’d hoped.

I tried running silicone down the cavities in the shaft.
I tried running silicone down the cavities in the shaft.

My first challenge was to get enough protective silicone around the central shaft of the negative model so that people’s privates would be protected. I started by trying to inject silicone into the ridges in the shaft. This was only partially successful.

Injecting the silicone didn’t seem to have any impact on the quality of contact between the mold and the silicone.

I worked non conductive silicone around the central shaft.
I worked non conductive silicone around the central shaft.

This was the one and only time that choosing a “fast cure” silicone helped me, because I was able to simply keep working the silicone around and around the central spiral with a plastic knife until it cured for me. The material became more and more “goopy” over time, but I found that even though it had a lumpy texture on the outside, the silicone was still filling in all the gaps properly.

The final layer of conductive silicone in the mold.
The final layer of conductive silicone.

I placed the “bottom middle” piece on the bottom piece. It turns out that because ABS plastic warps a little, you have to put a fair bit of pressure on to make the pieces meet. I used insulation tape for this purpose but immediately realised that this was not the best choice. It doesn’t stick well to the ABS plastic and stretches a little.

I am glad I made the mold in parts.
I am glad I made the mold in parts.

Mixing small batches of silicone is very difficult. I found that it’s easier to decant the two-part silicone into two containers beforehand and use a syringe to measure a smaller amount into a mixing container. I think that in future it would be better to have a design that allowed me to mix up larger batches of silicone.

De-molding the toy was a lot harder than I expected, probably because the silicone is harder than it should be. I am glad I made it out of four parts. Perhaps in future I should make the central shaft its own 5th part, which would make disassembling the mold much easier.

Much to my surprise, once I hooked it up to a capacitive sensor, the prototype actually works. With one electrode in the device, it can pretty much tell how far a finger is in the device.

The video below shows the device detecting a finger’s depth with just a single electrode.

With two electrodes, I can get better fidelity, though I noticed that there was interference between electrodes.

I learned the following lessons from this exercise:

  • There’s a false economy to silicone, where you try to use less, but end up using more. There always seems to be left over silicone and you may be tempted to re-use it, but this may result in a worse outcome over all.
  • Silicone is best additive, that is to say, it’s very hard to remove bits off silicone once it’s been cured, but it’s very easy to add bits.
  • Shore A10 silicone is way too firm for the inside of a masturbator, no matter how big the cavity is, it will hurt your male bits. I think shore 00-30 would be the better bet.
  • Getting silicone off a rigid mold requires deforming the silicone more than you expect.
  • Super fast curing silicone is silly, especially if you are putting additives like carbon fibre in it. I think 20 / 30 minutes pot life (Medium) is what you want.
  • More than two electrodes seems to be over the top since they start interfering with each other and throwing the measurements off.

As a bonus, here’s a demonstration of just how durable silicone can be:

The masturbator is very robust to stretching and retains all its properties.
The masturbator is very robust to stretching and retains all its properties.

 

Designing the mold for a sensing Masturbator

Original 3D Model Design
The original model would have been difficult to pour layers into.

So, my experiments in capacitive sensing have all been in aid of creating a device that can be used for interactive sex games. This post focuses on the design of a masturbator device.

In order to make a silicone device, I need a “negative” mold to pour the silicone into.

I started with a model that I discovered online, called the Helisex. It’s designed is in two parts that your pour silicone into. Once the silicone cures, you release it from the mold and you have your glorious masturbator. The twisty center piece is designed to stimulate your member when you insert it into the silicone toy.

My intention was to design something that could have layers of conductive and un-conductive silicone so I could detect how far in the dong went. The helisex design would have been very hard to layer silicone into, so I separated it into four pieces:

I split the negative mold into four parts.
I split the negative mold into four parts.
3D Printed mold in process using ABS plastic.
3D Printed mold in process using ABS plastic.

Note that since I was 3D printing these parts, there’s no way I could simply split the model into 4 equal parts, because the center piece would have nothing to connect to. I decided on the “tower in the base” approach, because that could allow me to cover the center piece in un-conductive silicone.

Conveniently, a friend of mine has a 3D printer and was able to print the models for me.

The 3D printed model came out very well, albeit a little warped.
The 3D printed model came out very well, albeit a little warped.

The 3D printed objects came out very well.

I used 180 grit sand paper to sand the ridges out of the parts.
I used 180 grit sand paper to sand the ridges out of the parts.

After the models were printed, I set about sanding. I had to get the top piece re-printed because I had misjudged the height of the center column by 10 mm.

I sanded every piece with 180 grit sandpaper to help get rid of the ripples that is characteristic of 3D printed parts. I then sanded with 240 grit and 400 grit. To be honest, I think the 180 grit did all of the work and the other sand paper didn’t make much difference to the result.

I resized the cavities for the nubs with a drill bit.
I resized the cavities for the nubs with a drill bit.

The little plastic nubs and cavities were built into the model to allow them to line up properly. The “Negative” cavity was invariably too small (or the nub too large) because I didn’t realise I needed about 0.5 mm clearance either side.

No matter, a drill bit and elbow grease soon fixed that problem! I took a drill bit and filed out the excess from the part. This turned out to be quite easy since the ABS plastic is relatively soft.

The drill bit went right through the part into the softer "fill" printed area.
The drill bit went right through the part into the softer “fill” printed area.

What I didn’t realise is the “wall” of the 3D printed part is only about 1mm thick, so a little vigorous filing will easily perforate the wall of the printed part. Fortunately this was not a big deal and in hindsight, I would have probably been better off with holes for bolts anyway rather than fancy little nubs.

I learnt a few things out of this exercise:

  • ABS plastic warps (unlike PLA) so although ABS will last longer and is definitely safe with silicone, PLA might be a better choice if the mold parts need to fit together perfectly.
  • About half a millimetre of clearance is required for parts to slot into each other, this can be achieved by sanding.
  • Chunky mechanical connections are better than fiddly ones.
  • Making holes all the way through is better than a cavity part way through.
  • 2mm is the narrowest you want to make any piece in a 3D printed object
  • The outer “shell” of the 3D printed part is thinner than you think and you can easily perforate it. If you do, it’s not the end of the world.
  • 3D printed parts work well subtractive, that is to say: you can always shave something off the model more easily than adding something.

Capacitance Sensing with Conductive Silicone

I’ll start with the result for those who don’t have time to read. With 10mm of non-conductive silicone insulating the carbon-fibre conductive silicone, we still get a pretty good change in capacitance which can be detected.

This is great news! The 10mm of non conductive silicone can act as a physical barrier whilst the conductive silicone acts as the touchable surface.

How does it work?

The headers have been installed on the shield.
The headers have been installed on the shield.

I bought a MPR121 Capacitive touch shield for the Arduino. The first challenge I had, having never used an Arduino before, was to figure out how to assemble it. They come with little headers that you solder onto the shield, which is quite easy to do, especially if you use the Arduino as a guide (stick the long end of the headers into the Arduino’s connectors and then solder the shield onto that) just be careful not to overheat any components!

The MPR-121 shield snaps easily into place.
The MPR-121 shield snaps easily into place.

The Arduino and shield just snap together. It took me an embarrassingly long time to realise this because I was expecting some fancy wiring. It’s just “plug & go”.

I then downloaded the code for the MPR-121.

My initial tests were disappointing: the system failed to detect “touch” whenever I touched the non-conductive silicone, but recognised a touch when I touched the conductive stuff. This is not what I wanted because as I discovered before, the conductive silicone has these little carbon fibre hairs sticking up out of it that could cause itchiness in places you really don’t want it.

I then realised that the sensor provides both baseline and filtered data. My understanding is that the baseline data is something akin to a moving average that is able to take into account noise and ambient effects (like humidity I suppose).

I found that when the sensor is touched “properly”, on the conductive silicone, the “filtered” value drops momentarily below the baseline value, triggering a “touch”. When I touched the non-conductive side, both the baseline and the filtered values drop at the same rate. This tells me that the drop is probably so small and gradual that it’s not picked up by the

My initial modified code is below:

/*********************************************************
This is a library for the MPR121 12-channel Capacitive touch sensor

Designed specifically to work with the MPR121 Breakout in the Adafruit shop
—-> https://www.adafruit.com/products/

These sensors use I2C communicate, at least 2 pins are required
to interface

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
**********************************************************/

#include <Wire.h>
#include “Adafruit_MPR121.h”

// You can have up to 4 on one i2c bus but one is enough for testing!
Adafruit_MPR121 cap = Adafruit_MPR121();
void setup() {
Serial.begin(9600);

while (!Serial) { // needed to keep leonardo/micro from starting too fast!
delay(10);
}

Serial.println(“Adafruit MPR121 Capacitive Touch sensor test”);

// Default address is 0x5A, if tied to 3.3V its 0x5B
// If tied to SDA its 0x5C and if SCL then 0x5D
if (!cap.begin(0x5A)) {
Serial.println(“MPR121 not found, check wiring?”);
while (1);
}
Serial.println(“MPR121 found!”);
}

void loop() {

// Get the currently touched pads
currtouched = cap.touched();
Serial.print(cap.baselineData(0));
Serial.print(“\t”);
Serial.print(cap.filteredData(0));
Serial.print(“\t”);

Serial.println();
delay(100);
return;

}

By changing the threshold values, we can change the threshold at which a “touch” and “release” are detected.

cap.setThreshholds(1, 1);

By changing the value of “Config1” we can increase the charge current of the capacitor, effectively increasing the range of values we can detect.

cap.writeRegister(MPR121_CONFIG1, 0x20); // 32uA charge current

My next test was to see what physical characteristics of my setup gave the best results. I came to the following conclusions:

  • Enameled magnet wire seemed like a good idea but when combined with many others of its kin, resulted in a higher overall capacitance, meaning it’s hard to detect touches.
  • The longer the wire is, the more capacitance it has and therefore the worse the ability to discern “touch”, the capacitance sensor will need to be as close to the conductive silicone as possible.
  • The more surface area of carbon fibre conductive silicone, the better the touch detection.
  • 10mm seems to be a nice thickness of non-conductive silicone, anything beyond 20mm is too thick.
Enameled winding wire is too narrow and not insulated enough so it has a very high capacitance.
Enameled magnet wire is too narrow and not insulated enough so it has a very high capacitance.