Her book draft excerpt {M} finds out.

{M } from her book

{what scene?}

{she finds out}

{jenny and I get overheard}  initially the scene is set as retrospective on the months of filming that have gone on

{m} First time singing

Then {jenny} and I are talking, not knowing {m} is there. Secret is out

{m} sees that she needs to try harder, is this real?

The studio building loomed beside as {jenny} and I walked the length of it. I’d lost any sense of the strangeness of this during the months the filming had gone on.  Working together in what were quite tough circumstances had made us very close. We were heading towards a cafe that surely had been there since before the studio was built, it seemed to exist in a little bit of the normal world, surrounded by the studio buildings. These were huge corrugated metal rectangles designed only for their functions, and without any regard for style. Ironically enough given what went on inside.

 

People mostly rode bicycles or electric golf carts, walking was usually something to avoid because of the scale of the place.  {jenny} and I didn’t speak as we walked, it was pleasant just to feel the wind and the warmth of the sun after hours spent inside under artificial lights.   People who noticed us always acknowledged {jenny}, no-one knew who I was, but I was happy to know that I was the one that was walking with her. I could see the questions in their eyes .

We turned a corner and I could see the cafe at the end of one of the steel buildings. It was almost hidden among a group of trees, and the green of its surroundings were always a relief after the stark white of the pavement. We visited this place at the end of most weeks, just to talk to plan and for me the experience more of {jenny’s} company. The windows were made of small rectangles of glass in dark wooden frames. Everything was wood, worn with many years of use. I imagined generations of alcoholic actors sitting at the bar, worn down by drinking, but hiding it easily from their public with charm and a nice smile.  Now the placed served coffee, and had cleaned up. It never seemed to be full of people, but there were always people here. Customers talked quietly or just sat in silence winding down after long stress filled days.

 

We walked in and took a corner table, {m} was due to arrive in about half an hour. We ordered coffee and talked.

 

The filming had been going on for over five months now, and the work had settled into a routine. {m} had begun to sing, and I had even begun to understand how to talk to her and to accept how different she was to my imaginings.  Still in those instances when she was like one of her characters I would just smile. I think she played for those smiles, just to tease me.

 

The band had accepted her now, understanding that behind all the weirdness that fame produces, she was as hardworking as they were, and she was just a person. She had a family to go back. Sometimes she got sick, but she’d always turn up, even when it was obviously very difficult.  When she wore no makeup and dressed without care it was almost possible to forget who she was. She had people she loved, trusted, disliked or just ignored. But then, the sight of her driving up to the studio building in the Ferrari, made you realise exactly who this was, the money she controlled, the true weirdness of the life she existed in. But then each morning she’d come in,  hugging each of us in the innocent way she had.

 

The coffee was always really good here, the waitress didn’t speak as she served us. I just sat looking at {jenny} drawing out the time until I would take my first sip. Often there was nothing said for quite some time. She knew I liked to watch her, and she didn’t mind it.

 

The conversation proceeded in an ordinary way then, we talked about what had gone on in the week, and discussed scenes that would be filmed soon. We also talked about song choices and wondered about marketing things we could do. But then,

 

“so, you haven’t told her, and she hasn’t guessed.”

“well I just don’t think it’s appropriate. what would she do”

“she trusts you absolutely now, I’m sure she’d understand. I don’t see what the problem is, I think she’d love the idea if the new. that she is playing a character that was only written for her, but is her”

 

“what?”

We both looked round at this, {m} was standing there having walked up to us quietly.

“what do you mean written for her, and is her, you’re talking about me right?”

I was silent, I couldn’t think of anything to say other than to tell the truth. I was embarrassed at our indiscretion.  I knew I had to speak now. {jenny} was just smiling at me, and seeing the look on her face I believed she had hoped for this moment.  I felt like poking my tongue out at her.

“well, and please don’t get angry, your character in my book is you. I didn’t just write a character that I thought you might like to play and be suitable to play, but I wrote you into the book as the person I imagined you to really be. so now you are really playing yourself.  Well a kind of combination of that character and you. Does that make sense?”

“and why haven’t you told me this, didn’t you think I’d want to know, surely you know me well enough now?”

“ah, shit, I feel bad, I know I should have, but at first when I didn’t know you I just felt no-one needed to know about my craziness, and I was worried, I admit it. “

“but now you know I wouldn’t do anything, you’ve known it for some time?”

“well, yes , are you angry?”

“no, but I am a little disappointed, you should have mentioned it. but why not?”

“I was worried a little bit that you might think I had some sort of a fixation on you,  I didn’t want you to think I was a creep or anything like that. ”

“oh, but there’s no question of that, surely it’s obvious that I don’t think that way.”

“I know, I know but it is a fear of mine, as an older guy, perhaps a paranoid fear.  what if there’s an evil inside me and I lose control.”

“you say such stupid things sometimes, come on, there’s nothing like that, we know, you’ve just been watching too many movies, {m} and I have known you now for quite some time, and I know that I have never had the slightest doubt about you.  ”

“yes, don’t worry about it, I forgive you, not that there’s anything to forgive, but I’m extremely curious about this. do you think I’m like {her} for instance.”

 

“Ah, I didn’t think of this, how to explain.  There are facets I guess, mannerisms. {she} is kind of pathetic in some ways though and you’re not, not at all.  You’re shyer than I expected, but that just says to me that you’re much braver.”

At this point she leaned over and kissed my cheek, I could feel my face burn at this.

“thankyou, what else”

“well, I was already prepared by meeting {jenny} here, for the realisation there’s going to be a completely other person there, unrelated to any character I’d seen you playing.  Before, I had this weird idea of actors, that they inhabited some strange other world without cares or the worries of the rest of us. I’d seen real estate photos of a house {jenny} was selling and got a sense of this weirdness from that.  But now I see that the fame and the money it only adds things it doesn’t replace them so I see all the normal things going on in your lives, both of you. You’re just like any number of amazingly attractive women.”

They both laughed at this.

“I see that that creates all the normal problems, though don’t worry.  I think the most compelling thing is that I have seen the contrast between the confidence that you both share, but have seen the surprising vulnerability. ”

“surprising?” {jenny} said

“well, not now, but it was originally, when I was ignorant. I imagined the fame would produce a confidence that would mitigate against any negative feelings. How silly was I?”

“with some people it does”, {m} said, “or perhaps it just appears that way, people often ask if the fame has changed me, which of course it has, but they don’t ask the question, ‘has it helped me’?.  And the answer to that is I’m not sure. “

“well, I guess you probably won’t ever have to get a real job.”  I tried to say this with a straight face but failed.

 

Cafe scene; a waking dream of {E}.

I often entertained the idea that when I was sitting in public like this that some person, really it was always a woman, one that I’d known from somewhere, a work colleague, that was most likely. That she’d just walk up to my table and sit down. Often these imaginary meetings turned out to seem more real than anything in reality. I’d look up in surprise and there she’d be. A little older than when I’d first worked with her. {E}. I think I’d loved her from the first moment I’d seen her, I’d been sitting across from her in a meeting. She’d had straight black hair cut in a bob I guess it was, to me I always imagined it was a kind of an Egyptian look. I was lost from that first moment, but I hadn’t really talked to her until a long time later than that. I’d interacted with her when she needed to work with me but that was all. But at some point we did begin to talk. And in the end I’d spent a lot of time talking with her and I felt we’d got to know each other quite well. And there’d been moments when I thought she liked me more than as just a work acquaintance, but I’d never told her how I’d felt. There seemed to have never been a moment when I felt able to bring up the subject of us. I had a whole set of excuses that always stopped me, she was too tall, too good looking, too young. And the biggest excuse was that it was work and what if I made a misstep and she complained of some kind of harassment, I’d be in deep trouble. So I never knew if she felt anything, and when I left ,(although my exact method of communication escapes me), when I told her of my divorce she seemed to want nothing more to do with me.

But right now, here in Paris I see her walking in through the door. I had the shock that you do when you see someone special, someone with whom there’s been an emotional connection. And I’d forgotten how striking she was, how beautiful, the kind of beauty that doesn’t need makeup. Although she wasn’t in any way a cliche, she looked like no-one else I’d ever seen, like some kind of Gothic, Bohemian princess. Pale, black hair, fine skin, tall, intelligent. And smiling. And that’s what she did when she noticed me, I thought she might not see me but she was checking the room, perhaps to see if there were any tables free and without any hesitation she came and sat down in the bentwood chair to my left.

She leaned over and kissed my cheek.

“Hi, now I believe you’re real, I was having some trouble believing it could be you ”

“It’s good to see you too, and who else would it be?”
“Oh, no one else is like you, I was only filled with disbelief. Are you on a holiday over here?

“No l I work here now, in .. {some place close}.”
“The same kind of things”
“Yes, mostly the same. And I have friends over here too, the kids know each other so it’s worked out well.”
“What are you doing here I haven’t heard anything about you since you left?”
“Ah well, tomorrow, and believe it or not, I start school here, a music school. I’m leaving the IT behind, I already left it behind quite some time ago.”
“Are you serious? I would not have suspected it.”

“No I guess you wouldn’t have, the music is something I’ve found it difficult to admit to myself. But I’ve finally given in to it, some kind of compulsion to perform I’m not sure.”

“This is amazing, I’m pleased for you.”

“Thanks, although I must admit I am filled with fear, they tell me the school is hard and it’s different to IT, I knew I could do that, this I know nothing about. I just have to hope. But right now, you’re here, making me forget everything. I’ve missed you you know, I was sad when it seemed you didn’t even want to be my friend. Once I left, once I told you I divorced”
“But I think you loved me, and I didn’t want to hurt you or disappoint you, and you know I’d met someone, you knew that.”
“Why does loving you preclude being your friend, and you never said anything?”
“Oh so you admit it, you loved me, and why didn’t you say anything?” She laughed.
“Was it so obvious, and no I don’t want to deny it? Of course I loved you, from the first time I saw you. I couldn’t help it, who could? But I could have been your friend. Surely”
“And not get hurt?”
“Of course I’d get hurt, I already did, I always do, but that’s how I know I’m alive sometimes, and I’d have been able to spend time with you.”

“You hardly know me, how could you love me?”
“We talked quite a bit if you recall, but you’re right, you’re a very distinctive looking attractive woman and I was lost. I just fell in love at first sight, that can only be a thing if falling in love doesn’t need knowing. But then, perhaps it is possible to judge a book by the cover, sometimes, and I think that my first instinct,or whatever it was, was quite correct, knowing you even a little bit more only affirmed my original fall. I never changed my mind about you, even after I realized you’d probably be quite difficult.”
“Difficult, oh, and what does that mean?” She smiled.

“Just that I can’t imagine being able to let my guard down, difficult is a good thing by the way, in my view anyway. Anyone who isn’t difficult is probably boring.”
And by a supreme act of bravery I didn’t wait, but I brought up the subject of her current romance.
“I suppose you’re married now, to that guy”
“Oh no, that didn’t last too long.”
“So you’ve met some French guy, after all I can’t imagine anyone being able to resist you.”
She just smiled and shook her head.
“I don’t understand, am I only imagining how beautiful you are, is there something wrong with me, perhaps I’ve only ever dreamed you?”

And of course I was, and now as the conversation seemed to to turn towards a place I never really ever believed it would go the horrid realisation came over me that I was about to get hurt, as in my imagination this meeting was no accident, but it was fate bringing us together just at the opportune moment, the moment for my second chance.

But of course, nothing would ever really happen? I’d lost her, and I wasn’t sure I’d ever had her . There was a gap when she was single after her divorce where things may have happened, but I never knew about it. And I can’t imagine I’d ever have had the courage to approach her romantically. And throughout most of the time when I was getting to know her she was meeting her new guy. By now they’re probably married. And I’d never see her again, I knew it. Her interest, in me, however strong it was, hadn’t lasted, I felt sure. Perhaps, in reality, she didn’t even remember me, but even if she did, it felt inappropriate for me to contact her even to try to rekindle the friendship. I couldn’t imagine being able to say anything that would convince her things could be innocent, and that I wouldn’t be some kind of a problem for her. And of course there was the new boyfriend, likely new husband; it just wouldn’t work. Perhaps if we had mutual friends, but no we didn’t. How could we, when I had no friends of my own.

I’ll always wonder if she did actually like me at some point. Strangely, just sitting here thinking about her has reminded me that there was one occasion when she did actually see me at a random place, and she had approached me. I’d forgotten this. I was sitting outside waiting for my son to finish gymnastics. Her children were doing gymnastics at the same center. So I was sitting outside waiting, and then there she was, she recognised me and she walked up to me. We talked, I don’t remember what about. I smiled now to think of it, but this was tempered with the sadness of the realisation I’d never see her again. It’s a weird feeling, happiness and sorrow at the same time. I treasure the thought of her even as I feel the loss.

The same waitress re-appeared with my scrambled eggs. I thanked her, but I couldn’t in that moment think of anything to say, my head was filled with {E}. She started to turn away, but then she hesitated and turned back. I looked back up at her feeling a momentary shock.

 

peter.cupit@gmail.com

Clothes dryer project part 3

I work on the dryer every now and then, and at present I am working on the chimney and the ‘chimney pot’ which is design to extract air passively by the Bernoulli effect. I have also removed the light and will add a secondary fan instead. This fan will move air around inside the cabinet. I am also going to add a power switch and a dry switch (to initiate a drying ‘cycle’). This second fan will push air down from just under the roof and I hope this will mean the humid air distribution will mean that the sensors will see a humidity rise and then the computer can be programmed to handle this humidity and turn of when it drops, which hopefully means the clothes are dry. A secondary benefit of the internal fan is to stop the bad smell which gets into the clothes because of the lack of air movement. It turns out I think that just sucking out the humid air up the chimney does not work to dry clothes, air must be required to flow past the clothing.

Chimney version 4.

Chimney version 3

Nature and complexity.

I was on my way home after going for a walk on the hill behind my house when I was suddenly struck by the complexity that was embodied in the birds singing and flying and the fine structure of the trees through which the birds flew. The activity struck me first as an unnecessary thing, why did the birds sing so sweetly, why was the filigree of leaves so beautiful against the sky? Then a thought struck me about what I think was really going on.
I tried afterwards to put this into words, I’m not sure I succeeded but here goes:

Nature is an interconnected, parallel mechanism with extreme complexity. The behaviors of a multiplicity of organisms fill biological niches in symbiotic ways to balance the supply and demand of need. Order and beauty are emergent properties of this.

Humans seem to act outside of nature, we aren’t naturally limited, our balances are artificial and want’s drive us. We strive for imbalance and value things which aren’t needs at all.  Sometimes the things we strive for are beautiful and have values that are intellectual or spiritual beyond anything else that exists in nature, but these cases seem to be the exception.  Sometimes it seems that most of what humans do and want and have is all worthless and worse, destructive.

 

Nature

peter.cupit@gmail.com

Hitachi 63B09E SBC

I recently learned that there is some kind of a new thing started up that is all about Motorola? CPU based single board computers. So I thought I’d post one that I made in uni about 28 years ago. The label on the EPROM is Assist09 so it’s possible that it would boot and allow me to upload code etc if I had a serial cable of the right kind. The board was part of an ultrasonic range finder project I made for uni. I made 3 main boards (all hand wired) along with a sonar head which had yet another board with OpAmps. There was also a power supply box, a keyboard and an LCD. – these days you could do the same thing with an Ardunino Pro Mini, an I2C display and an ebay ultrasound module. The software had a menu system I copied from Supercalc. I wrote most of the software in ‘C’, to do this I found some code to give an early version of GCC the ability to generate 6809 assembler. This ‘OS’ had only the keyboard scanning and interrupt code in assembler. I remember running pmake on the unix server at RMIT when I was compiling the compiler and almost bringing the server to its knees.

The Hitachi 6309 was an enhanced version of the Motorola 6809 Hitachi 6309, and I think I did use some of the extra instructions. I believe there was a 16 to 32 bit multiplication available which I used.

As you can see this was point to point soldered; at that time I had no practical / cost effective way of making a PCB. I am tempted now to do something with this computer, at least to see if it still works, although I have thrown my EPROM programmer and any capability to erase EPROM’s into the tip. I’m sure there are ebay cables, programmers and erasers.. Of course If I can find the actual EPROM with the sonar software, surely I haven’t thrown that away.

Perhaps this is of interest to someone.

Cpu Detail

Cpu Detail

Front of board.

Front of board.

Back of board.

Back of board.

Clothes dryer project part 2

I haven’t really done any work on the dryer at all, none of the software is done and all I did was test that the new dual channel humidity and temperature sensing would work. By the way to do the dual channel I had to use a quad analogue switch to switch the I2C since the ebay sensors I’ve got don’t allow a choice of the I2C address.

What I have been doing is designing a PCB for the controller part, and tonight I sent if of to Seeed Studio to get fabbed. This cost me just over $20 Australian, although I have to wait from between 15 – 30 days for the boards to arrive (I get 10 although I doubt I will ever use more than one). I am quite nervous that the fab will fail or that my design can’t be fabbed, or, of course that I haven’t transcribed the circuit from my hand wired version.

Kikad takes a little bit to get used to but it wasn’t that difficult to design this board; not that it’s a very big board. The last time I had a board I designed made I had to lay it out with black tape, I hardly recall, but it must have been painful. Although neither method is as painful as doing point to point wiring, even at this small scale. I’ve done a board with point to point soldered connections using wire wrap wire, where each end needs to be stripped, that had hundreds of connections. I can’t believe I did it now. That was the graphics terminal, I wish I still had it, I would frame it an put it on the wall.

How the design looks in Kikad.

How the design looks in Kikad.

This is the board in the gerber viewer.

This is the board in the gerber viewer.

I am not motivated at present to do much else at the moment even though I have had some good ideas about the software; once I can measure the ambient humidity then I think I can make the thing work more sensibly. I have again found that clothes that are hung on the line still dry faster and clothes dryed in the dryer sometimes have a faint smell about them. I think it depends on how much sun is available. I really need to design and build the new air extracting chimney hat and of course create at least version 2 of the software ( to control the fan by comparing inside and outside humidity ).

Just awaiting my board now.

Clothes dryer project part 1

I have had a long time interest in natural heating and cooling for houses. I hope to be able to have my own place one day, and I’d like this home to be passively heated and cooled, but that situation is out of my reach at present.

To partly satisfy my interest I been building a clothes dryer that is located outside and uses the wind and the sun, but protects the clothes from getting wet when it rains. My hope is that this dryer will be more effective that an ordinary clothes line by trapping infra red and capturing the wind more effectively. Other advantages are that there is no need of pegs, and UV light is blocked. I also intend to power the electronics (which includes the controller, fan and a door activated light) with a battery that is charged with a solar panel.

My current design is only partly successful and I am in the process of doing some improvements, however the first version had the following features that were my first attempt to meet my goals.

1. I used used poly carbonate sheeting which blocks UV but lets IR through.
2. I tried to make sure there are weather seals at every join so air is trapped
3. I made a chimney with hat to utilize the Bernoulli effect to provide a way to draw we air out
4. There is a control system that measures temperature and humidity so that a fan will turn on when the humidity rises above a set point.
5. The controller has Wifi enabling remote monitoring / graphing.

The first version was only partially successful. I do see a temperature and humidity rise above ambient when wet clothes are put into the cabinet. The fan does come on and the humidity then drops. Clothes do dry and come out warm – if there is enough sun to warm the system. The cabinet does protect dry clothes if it rains, and I don’t need to worry about forgetting to bring in the washing.

The dryer.

The dryer.

However for any reasonable amount of wet clothes the humidity overwhelms the fan and the clothes do not dry more quickly than clothes hung out on the ordinary clothes line. In addition it appears that the chimney does not draw very well (or at all). Additionally, measuring the internal humidity is not a good way of determining whether or not to turn on the fan since at night the humidity can often rise quite sharply (probably when the dew falls).

I am in the process of modifying the system to improve it:
1. I have put in a large fan with more airflow and made a proper seal for it.
2. I am modifying the controller by adding an extra sensor channel so I will be able to measure the ambient temperature and humidity so that I can control the fan when the internal humidity rises when the external does not.
3. I will add a detector that senses whether washing is hung inside the system.
4. I will modify the passive chimney extractor to move with the wind and have a double cone shaped wind collector to increase the chimney draw.

My next task is to finish the modifications to the controller software and then do more experiements in order to tune the way the fan works. Once this is done I will make the new chimney pot and again experiment to see how that affects the drying time.

Circuit diagram.

Circuit diagram.


Mosfets and 5V power.

Mosfets and 5V power.


Controller

Controller


Chimney rear view

Chimney rear view


Chimney hat.

Chimney hat.

Notes: the embedded controller is a Weimos D1 Mini.

CBR650F collision with Kangaroo.

On the weekend I hit a Kangaroo whilst out riding my bike; a Honda CBR650F. I was travelling south towards Tharwa on the Tidbinbilla road perhaps 200m or so North of the Corin road turnoff. Luckily I did not fall of the bike and was able to keep riding it but it was pretty badly damaged as can be seen in the photos that are linked below. The incident is a bit of a blur, all I remember is seeing the Kangaroo at the side of the road and watching it jump and then I have a vague memory of hitting it. Then it was gone and I was still riding, shocked I guess because I kept on going for a bit before stopping by the side of the road. Some people, two cars, stopped in front of me and came to ask me if I was ok. One of them gave me a bottle of water. I think they must have seen the whole incident. They told me I was lucky. I think I was amazingly luck, almost unbelievably so. Why didn’t I crash? I think possibly because I had no time to swerve and somehow caught the Kangaroo just under the headlight so the energy was transmitted straight down the bike and not under the wheel or sideways. The mirrors were moved forward and I must have been shifted forward, violently but I can’t remember that happening. Currently the bike is being assessed for Insurance purposes. If the frame is bent it will be written of, I couldn’t tell if any major damage to the frame or forks had occurred; while riding the bike after the incident I could not feel anything different, perhaps only a little more noise probably due to the missing fairing. Perhaps Honda might be interested in seeing how much damage can occur to one of their products whilst leaving the machine still functional; I think I will send a link to this post to them.

These are a group of images of my bike after the crash.
Images of the crash

Open source housing the fantasy – part 4.

The evening after we’d come back from the site I spent a lot of time trying to get a better sense of the viability of the scheme.  The open source housing website was the most convincing aspect of the whole project. This website was designed to facilitate the complete process of the construction on a house.  Initially a user would register and start a design in a 3D graphical modelling program. A house had to be designed using components from the standard set, and the software had an understanding of which components could fit together. Similarly when components were moved to a close proximity in the model they would snap together in ways that were valid for the pair of components. I discovered that there were standard builds that could be loaded and then modified or not. Additionally, the designs of other users of the software were all available From all of this investigation of the software I felt that this standard set of components would allow, within reason, a reasonable variety of houses to be designed. There would be similarities between all of the dwellings of course, but not so much that my sense of style (not a very well developed sense in my case) was offended.

And then, after a design was completed, a design rule check would be run automatically showing a list of problems and indicating each on a 3D visualization.  The design could then be edited to fix the problems. The documentation indicated that in most cases the 3D editing program would be able to make sure that design rules were obeyed during the creation of the design, this was facilitated by having very strong and light components.

Once a structurally sound, standards compliant design was complete other software produced parts lists and then built a plan for the construction. This plan contained the sequence of operations on the house components in the order that would produce the finished dwelling, but in addition to this was another sequence that showed the operations required to build the components of the house. This second sequence was the most complex since it relied on a group of house builders to work together, but geographically dispersed, to construct components for all of the members’ house builds. The software would not only produce these sequences but would allow all the members of the dispersed team to interact with other, so for example as members of the group finished particular components the builders would log in and mark of that the items were completed. The software would then organise transportation of components as required so that builders would have access to components as required for each of their build plans. The complexity was daunting.

I was conflicted and confused by the capabilities of the software when contrasted with the other aims of the project. It seemed hypocritical to rely on the one hand on this sophisticated program, and then on the other to advocate a style of building that was designed to use as little technology as possible. So I added myself anonymously to the forums that were used to discuss the project. I was heartened to discover that the on-line behaviour in these forums was for the most part unusually polite. After reading for almost an hour I came across the following explanation from a woman who I recognised as being one of the original founders.

“Some people have criticised us for our use of the technological advantages of computer system. Apparently we’re supposed to give up all these advantages and build our houses with stone axes. We say one thing and do another, advocating simple tools and then we go on about a massively complex tool. They suggest out ideas are without merit because our project is not future proof if that future is not bright but instead is a collapse. They even go as far as to suggest we are hiding something and really just want to collect free labour in some sort of pyramid scheme of woodworkers. We are told that we are actively deluding people by playing on their romantic ideas about living in houses built built by the owners and that augment nature rather than pollute and waste it.

What I want to say is that of course we want to use technology where we can, but only in ways we know we can do without. The design of the house building components employed many hours of simulations and is fixed. We’ve proven that these components are a good enough set to be radically useful without needing redesign. The components and the houses can be built without power tools or electricity, but it is quicker if you do have access to these things. And finally, the most criticised element, the build management tools on the web. I admit, this is an incredibly useful tool, it stops waste, optimises time and generally enhances the efficiency and quality of the build process beyond measure. It can be replicated with people though, not as well, but the process is well documented. This is the point and the essential trick built into the project. The backup plan if you want to think of it like that. So there is a book, widely distributed, which contains the procedures, plans and techniques from which the computer system was built. “

Ruby debugging using Aptana

For a long time I have been unable to use a debugger in an IDE for Ruby. I couldn’t ever get the correct gems installed into Netbeans and had just given up. Today, as a part of setting up my computer after a motherboard transplant, I have found a solution. This might be useful for others so I will post it here.

What I have now is Aptana Studio 3 with Ruby 1.9.3p551; with a working debugger!

I downloaded the following files:
Aptana_Studio_3_Setup_3.6.1
rubyinstaller-1.9.3-p551
DevKit-tdm-32-4.5.2-20111229-1559-sfx

The steps to install (on Windows 7) are:

  1. Run the ruby installer and tick all options.
  2. Run the DevKit application, this will unzip its contents. Choose a permanent target folder for the extracted files.
  3. Open a DOS window and change the folder to wherever the DevKit files were extracted.
  4. In the DevKit folder run ‘ruby dk.rb init’ and then ‘ruby dk.rb install’
  5. Then in the same folder (although it doesn’t matter) run ‘gem install debugger’ and then ‘gem install debugger’
  6. Exit the DOS window
  7. Run the Aptana installer allowing this to install all options.
  8. Check the debugger by doing the following.
    1. Create a Ruby project in Aptana
    2. Once the project is created Add a new file, this must have an explicit ‘.rb’ otherwise the IDE won’t treat it as a ruby source file (you’d think a new file added to a ruby project would be ruby by default).
    3. Add the following code and set a breakpoint on the puts. In the Run menu invoke Debug. The program should stop at the puts (without doing any output). Then press F6 repeatedly to execute the program within the debugger, the breakpoint will get hit once more and then the program will exit.
    a = ["aaa", "bbb"]
    
    a.each do |s|
       puts s
    end
    

    Hope this works for you. Let me know if not.

Debugging the DYPTH01B-SPI

This is a description of the methods I used to get a DYPTH01B-SPI temperature and humidity sensor working with my Arduino Pro Mini. I’d almost given up on the thing many times; it has been a struggle to get any meaningful data out of the device. In the end I discovered what I think is a weird interaction between the example code I had copied and the compiler. This was a red herring that caused me to look down incorrect paths whilst I was debugging.

When I purchased the device I didn’t have a clear idea of what I would use the sensor for; I just liked the idea of measuring some real world data. My intent now is to use a couple of nRF radio transceivers to remotely sample data with the sensor being mounted outside.

I’d had the DYPTH for a while, but hadn’t done anything with it. This neglect was due to a lack of confidence in my ability to get it working, and because I had gotten distracted discovering that cheap ebay robotics motors aren’t precision devices…  (You’ve probably seen the little yellow DC motors on ebay.)

The DYPTH01B is weird because it acts mostly as a master but the slave must tell it to send. The DYPTH01B generates the clock and uses MOSI but the CE must be controlled by the slave which in my case is an Arduino Pro Mini.

I initially tried to use the code I found from here (see the section on Sensor 2).  I managed to get the same poor result that Matthew Little did which is that every now and then valid data appears (although the humidity seems a little high).  Some of the data seems almost random and has an invalid CRC and so is not converted to temperature and humidity. Sometimes a valid CRC is calculated from bad data so then I got weird temperature and humidity values including -ve values.

The following list I shows a selection of this bad data. The lists shows the 4 bytes received from the SPI and then the temperature and humidity calculated from these bytes in the cases where the CRC is correct:

0,81
1,2E
2,20
3,E9

0,1
1,2D 
2,A0
3,BE
T=-9.-9C, H=160%

0,28
1,34
2,80
3,4B

0,1
1,2D
2,A0
3,BE
T=-9.-9C, H=160%0,41

The following is my modified code that produces the above result:

// Written by Nick Gammon
// February 2011
// see http://mushclient.com/spi

// Rework for DYPTH01B_SPI Temperature and Humidity sensor
// using MTH01 Sensor
// D. Richards, Jan 2012
// see http://www.suntekstore.co.uk/product-14001923-DYPTH01B-SPI+Temperature++Humidity+Sensor+Module.html


int ledToggle = -1;
int ledCounter = 0;

#include <LiquidCrystal.h>
/* YourDuino.com Example Software Sketch
 16 character 2 line I2C Display
 Backpack Interface labelled "YwRobot Arduino LCM1602 IIC V1"
 terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <Wire.h>  // Comes with Arduino IDE
// Get the LCD I2C Library here:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
// Move any other LCD libraries to another folder or delete them
// See Library "Docs" folder for possible commands etc.
#include <LiquidCrystal_I2C.h>

/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address



//Arduino Pin =>  DYPTH01 Function
// SS         =>  LOW
// 11 MOSI    =>  SDAT
// 12 MISO    =>  nc
// 13 CLK     =>  SCK

// 5V         =>  VDD
// GND        =>  VSS
// 7          =>  Reset
// 8          =>  CE

//#include "pins_arduino.h"

byte buf[40];
volatile byte pos;
volatile boolean process_it;
int MTH_temperature;
int MTH_humidity;
#define HCS 8
#define HRT 7
#define FRQ_MON 5
byte clr;

/*
  The following procedure calculates the CRC-8. The result accumulates in the variable CRC.
  Var CRC : Byte;
  Procedure calc_CRC(X: Byte);

  Begin
  CRC := CRC_Table[X xor CRC];
  End;

 Polynomial is x^8 + x^5 + x^4
*/

const unsigned char CRC8table[256] PROGMEM = {

  0, 49, 98, 83, 196, 245, 166, 151, 185, 136, 219, 234, 125, 76, 31, 46,
  67, 114, 33, 16, 135, 182, 229, 212, 250, 203, 152, 169, 62, 15, 92, 109,
  134, 183, 228, 213, 66, 115, 32, 17, 63, 14, 93, 108, 251, 202, 153, 168,
  197, 244, 167, 150, 1, 48, 99, 82, 124, 77, 30, 47, 184, 137, 218, 235,
  61, 12, 95, 110, 249, 200, 155, 170, 132, 181, 230, 215, 64, 113, 34, 19,
  126, 79, 28, 45, 186, 139, 216, 233, 199, 246, 165, 148, 3, 50, 97, 80,
  187, 138, 217, 232, 127, 78, 29, 44, 2, 51, 96, 81, 198, 247, 164, 149,
  248, 201, 154, 171, 60, 13, 94, 111, 65, 112, 35, 18, 133, 180, 231, 214,
  122, 75, 24, 41, 190, 143, 220, 237, 195, 242, 161, 144, 7, 54, 101, 84,
  57, 8, 91, 106, 253, 204, 159, 174, 128, 177, 226, 211, 68, 117, 38, 23,
  252, 205, 158, 175, 56, 9, 90, 107, 69, 116, 39, 22, 129, 176, 227, 210,
  191, 142, 221, 236, 123, 74, 25, 40, 6, 55, 100, 85, 194, 243, 160, 145,
  71, 118, 37, 20, 131, 178, 225, 208, 254, 207, 156, 173, 58, 11, 88, 105,
  4, 53, 102, 87, 192, 241, 162, 147, 189, 140, 223, 238, 121, 72, 27, 42,
  193, 240, 163, 146, 5, 52, 103, 86, 120, 73, 26, 43, 188, 141, 222, 239,
  130, 179, 224, 209, 70, 119, 36, 21, 59, 10, 89, 104, 255, 206, 157, 172,
};


void setup (void)
{

   pinMode(HCS, OUTPUT);        // CS output
  digitalWrite(HCS, HIGH);     // CS inactive
  pinMode(HRT, OUTPUT);        // RST output
  digitalWrite(HRT, LOW);     // RST active
  delay(2);
  digitalWrite(HRT, HIGH);     // RST inactive

#ifdef LCD
  lcd.begin(16, 2);  // initialize the lcd for 16 chars 2 lines, turn on backlight
  lcd.backlight(); // finish with backlight on

  //-------- Write characters on the display ------------------
  // NOTE: Cursor Position: (CHAR, LINE) start at 0
  lcd.setCursor(0, 0); //Start at character 4 on line 0
  lcd.print("Weather");
#else
  Serial.begin (115200);   // debugging
  Serial.println ("initialising");
#endif
  

 

  delay(1000); // 100ms delay after reset.

  // get ready for an interrupt
  pos = 0;   // buffer empty
  process_it = false;

  //Sample on falling edge
  SPCR |= _BV(CPHA);

  // Clock idle when low set CPOL to 0
  SPCR &= ~_BV(CPOL);


  //  Slave mode
  SPCR &= ~_BV(MSTR);

  // Enables  SPE = 1
  SPCR |= _BV(SPE);

  clr = SPSR;
  clr = SPDR;
  // now turn on interrupts
  SPCR |= _BV(SPIE);



  digitalWrite(HCS, LOW);      // CS active, starts conversion

}  // end of setup


// SPI interrupt routine
ISR (SPI_STC_vect)
{
  byte c = SPDR;  // grab byte from SPI Data Register

  // add to buffer if room
  if (pos < 4)
  {
    buf[pos] = c;
    pos++;
    if (pos >= 4) // when all 4 bytes received
    {
      pos = 0;
      digitalWrite(HCS, HIGH);  // disable further conversions
      process_it = true;      // signal ready to main loop
    }
  }  // end of room available

}  // end of interrupt routine SPI_STC_vect

// main loop - wait for flag set in interrupt routine
void loop (void)
{
  byte idx;
  byte crc;
  byte byt;
  int i;

  


  if (process_it)
  {
    crc = 0;
    for (i = 0; i < 4; i++)
    {
      byt = buf[i];
      idx  =  byt ^ crc;
      //      idx  =  buf[i] ^ crc;
      crc = CRC8table[idx];
      //      crc = CRC8table[buf[i] ^ crc];
#ifndef LCD
/*
      Serial.print(" n");
      Serial.print(i, HEX);
      Serial.print(" b");
      Serial.print(byt, HEX);
      Serial.print(" c");
      Serial.print(crc, HEX);
      Serial.print(" i");
      Serial.print(idx, HEX);
      Serial.println(">");
*/
#endif
    }
#ifndef LCD
   for (i = 0; i < 4; i++)
   {
     Serial.print(i);
     Serial.print(",");
     Serial.print(buf[i], HEX);
     Serial.println();
   }
#endif
    
    

#ifndef LCD
    //Serial.print(crc, HEX);
    //Serial.print(", ");
    //Serial.println(buf[3], HEX);
#endif

    if (crc == 0 && ((buf[0] & 0xf0) == 0))
    {
      MTH_temperature = ( (256 * buf[0]) + buf[1] ) - 400;
      MTH_humidity = buf[2];
#ifdef LCD
      lcd.setCursor(0, 0); //Start at character 4 on line 0
      lcd.print("T=");
      lcd.print( MTH_temperature / 10);
      lcd.print(".");
      lcd.print( MTH_temperature % 10);
      lcd.print("C");
      lcd.setCursor(0, 1); //Start at character 4 on line 0
      lcd.print("H=");
      lcd.print(MTH_humidity);
      lcd.print("%");
#else

      Serial.print(" T=");
      Serial.print( MTH_temperature / 10);
      Serial.print(".");
      Serial.print( MTH_temperature % 10);

      Serial.print("C, H=");
      Serial.print(MTH_humidity);
      Serial.print("%");

#endif
    }
    else
    {
      // reset chip here
      digitalWrite(HRT, LOW);     // RST active
      delay(2);
      digitalWrite(HRT, HIGH);     // RST inactive
#ifndef LCD
      Serial.print("Reset");
#endif
      delay(100);
    }
    //   Serial.println();

    delay(2000);
  //  pos = 0;                // reset buffer index
    process_it = false;     // preset buffer not ready
    clr = SPSR;
    clr = SPDR;
    digitalWrite(HCS, LOW);    // start conversion

  }  // end of flag set

}  // end of loop

In particular note that I believe the setup of the SPI had some problems (although it’s possible that the SPI defaults to my explicit settings) eg -ve edge clock and clock idle low.

I fiddled around with this a while but almost gave up because there seemed to be too many variables – I didn’t know what was working.  Then the idea came that I should be able to bypass the SPI and read the CLK and MOSI data directly by turning the Arduino into a slow logic analyzer.  I determined that I could make a loop that could execute at about 25khz that was able to read two pins and store the data in an array. My vague understanding of nyquist indicates that this should enable me to sample a clock not more then 1/3 of this frequency which is higher than the 3khz DYPTH clock.  So the following code reads the temperature and humidity by interpreting the binary data from the pins of the DYPTH.

// Written by Nick Gammon
// February 2011
// see http://mushclient.com/spi

// Rework for DYPTH01B_SPI Temperature and Humidity sensor
// using MTH01 Sensor
// D. Richards, Jan 2012
// see http://www.suntekstore.co.uk/product-14001923-DYPTH01B-SPI+Temperature++Humidity+Sensor+Module.html


int ledToggle = -1;
int ledCounter = 0;

#include <LiquidCrystal.h>
/* YourDuino.com Example Software Sketch
 16 character 2 line I2C Display
 Backpack Interface labelled "YwRobot Arduino LCM1602 IIC V1"
 terry@yourduino.com */

/*-----( Import needed libraries )-----*/
#include <Wire.h>  // Comes with Arduino IDE
// Get the LCD I2C Library here:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
// Move any other LCD libraries to another folder or delete them
// See Library "Docs" folder for possible commands etc.
#include <LiquidCrystal_I2C.h>

/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

//Arduino Pin =>  DYPTH01 Function
// SS         =>  LOW
// 11 MOSI    =>  SDAT
// 12 MISO    =>  nc
// 13 CLK     =>  SCK

// 5V         =>  VDD
// GND        =>  VSS
// 7          =>  Reset
// 8          =>  CE

//#include "pins_arduino.h"

byte buf[40];
volatile byte pos;
volatile boolean process_it;
int MTH_temperature;
int MTH_humidity;
#define HCS 8
#define HRT 7
#define FRQ_MON 5
byte clr;

/*
  The following procedure calculates the CRC-8. The result accumulates in the variable CRC.
  Var CRC : Byte;
  Procedure calc_CRC(X: Byte);

  Begin
  CRC := CRC_Table[X xor CRC];
  End;

 Polynomial is x^8 + x^5 + x^4
*/

const unsigned char CRC8table[256] PROGMEM = {

  0, 49, 98, 83, 196, 245, 166, 151, 185, 136, 219, 234, 125, 76, 31, 46,
  67, 114, 33, 16, 135, 182, 229, 212, 250, 203, 152, 169, 62, 15, 92, 109,
  134, 183, 228, 213, 66, 115, 32, 17, 63, 14, 93, 108, 251, 202, 153, 168,
  197, 244, 167, 150, 1, 48, 99, 82, 124, 77, 30, 47, 184, 137, 218, 235,
  61, 12, 95, 110, 249, 200, 155, 170, 132, 181, 230, 215, 64, 113, 34, 19,
  126, 79, 28, 45, 186, 139, 216, 233, 199, 246, 165, 148, 3, 50, 97, 80,
  187, 138, 217, 232, 127, 78, 29, 44, 2, 51, 96, 81, 198, 247, 164, 149,
  248, 201, 154, 171, 60, 13, 94, 111, 65, 112, 35, 18, 133, 180, 231, 214,
  122, 75, 24, 41, 190, 143, 220, 237, 195, 242, 161, 144, 7, 54, 101, 84,
  57, 8, 91, 106, 253, 204, 159, 174, 128, 177, 226, 211, 68, 117, 38, 23,
  252, 205, 158, 175, 56, 9, 90, 107, 69, 116, 39, 22, 129, 176, 227, 210,
  191, 142, 221, 236, 123, 74, 25, 40, 6, 55, 100, 85, 194, 243, 160, 145,
  71, 118, 37, 20, 131, 178, 225, 208, 254, 207, 156, 173, 58, 11, 88, 105,
  4, 53, 102, 87, 192, 241, 162, 147, 189, 140, 223, 238, 121, 72, 27, 42,
  193, 240, 163, 146, 5, 52, 103, 86, 120, 73, 26, 43, 188, 141, 222, 239,
  130, 179, 224, 209, 70, 119, 36, 21, 59, 10, 89, 104, 255, 206, 157, 172,
};

const int MAX_VALUES = 250;
const int TURN_OFF_POINT = 200; //266;
byte pinReading13[MAX_VALUES];
byte pinReading11[MAX_VALUES];
void setup (void)
{

  lcd.begin(16, 2);  // initialize the lcd for 16 chars 2 lines, turn on backlight
  lcd.backlight(); // finish with backlight on

  Serial.begin (115200);   // debugging
  Serial.println ("initialising");
  pinMode(11, INPUT);
  pinMode(13, INPUT);
  pinMode(HCS, OUTPUT);
  digitalWrite(HCS, HIGH);
  pinMode(FRQ_MON, OUTPUT);
  return;



}  // end of setup


// SPI interrupt routine
ISR (SPI_STC_vect)
{
  byte c = SPDR;  // grab byte from SPI Data Register

  // add to buffer if room
  if (pos < sizeof buf)
  {
    buf [pos++] = c;

    if (pos >= 4) // when all 4 bytes received
    {
      digitalWrite(HCS, HIGH);  // disable further conversions
      process_it = true;      // signal ready to main loop
    }
  }  // end of room available

}  // end of interrupt routine SPI_STC_vect

// main loop - wait for flag set in interrupt routine
void loop (void)
{
  byte idx;
  byte crc;
  byte byt;
  int i;
  while (1)
  {
    delay(1000);
    // As soon as HCS goes low we start reading 11 and 13
    digitalWrite(HCS, LOW);
    byte pin13 = 0;
    byte pin11 = 0;
    byte bitPos = 7;
    int x = 0;
    char toggle = -1;
    while (x < MAX_VALUES)
    {
      //  toggle *= -1;
      //  if (toggle == -1)
      //    digitalWrite(FRQ_MON, LOW);
      //  else
      //   digitalWrite(FRQ_MON, HIGH);
      pin13 |=  digitalRead(13) << bitPos;
      pin11 |=  digitalRead(11) << bitPos;

      if (bitPos == 0)
      {
        //  lcd.setCursor(0, 0); //Start at character 4 on line 0
        //  lcd.print(pin11);
        pinReading11[x] = pin11;
        pinReading13[x] = pin13;
        pin11 = 0;
        pin13 = 0;
        bitPos = 7;
        x++;
      }
      else
      {
        bitPos--;
      }

      if (x >= TURN_OFF_POINT)
      {
        digitalWrite(HCS, HIGH);
      }
      // digitalWrite(FRQ_MON,HIGH);

    }
    /*
      Use the digital data to find the temperature.
    */
    int byteCounterForCollectedData = 0;
    int bitCounterForCollectedData = 7;
    int lastClkBit = 0;
    int currentClkBit = 0;
    int byteCounterForConvertedData = 0;
    int bitCounterForConvertedData = 7;
    int dataBit = 0;
    byte dataByte = 0;
    byte dataBytes[4];

    while (byteCounterForCollectedData < MAX_VALUES)
    {
      currentClkBit = 0;
      if ((pinReading13[byteCounterForCollectedData] & (1 << bitCounterForCollectedData)) > 0)
        currentClkBit = 1;
      if ((lastClkBit == 1) && (currentClkBit == 0))  // We have a -ve transition in the input bit stream as sampled from the SPI clock.
      {
        dataBit = 0;
        if ((pinReading11[byteCounterForCollectedData] & 1 << bitCounterForCollectedData) > 0)
        {
          dataBit = 1;
        }

        dataByte |= dataBit << bitCounterForConvertedData;
        bitCounterForConvertedData--;
        if (bitCounterForConvertedData < 0)
        {
          dataBytes[byteCounterForConvertedData] = dataByte;
          dataByte = 0;
          bitCounterForConvertedData = 7;
          byteCounterForConvertedData++;
        }


      }
      lastClkBit = currentClkBit;
   



      bitCounterForCollectedData--;
      if (bitCounterForCollectedData < 0)
      {
        bitCounterForCollectedData = 7;
        byteCounterForCollectedData++;
      }

    }

    int temperature;
    for (int convertedByteCount = 0; convertedByteCount < 4; convertedByteCount++)
    {
      Serial.print(dataBytes[convertedByteCount], HEX);
      Serial.print(",");
     
      
    }
     temperature = (dataBytes[0] * 256 + dataBytes[1]) - 400;
     Serial.print(temperature / 10);
     Serial.print(".");
     Serial.print(temperature % 10);
     Serial.print(" C,");
      Serial.print(dataBytes[2]);
     Serial.print(" %");
     
    Serial.println("");

    /*
      for (int x = 0; x < MAX_VALUES; x++)
      {
        Serial.print(pinReading11[x], HEX);
        Serial.print(",");
        Serial.print(pinReading13[x], HEX);
        Serial.println("");
      }
      while (1)
      {
      }
    */
  }



}  // end of loop

And this seems to work perfectly and the operation of the DYPTH agrees with the specs.  Ie after the CE is made low there is a delay before the device outputs 32 bits of data and if CE is only low for a short period then no more data is sent.   So now I could be confident that at least one thing was working.

So this morning as I was writing this entry I first did a recheck of my pin connections and found that where I had thought I’d connected Arduino SS low I had instead connected MISO low meaning that SS was floating. When I connected SS low I get much more consistent data.  Below is the data, note that I pinched the sensor with my fingers so both the temperature and humidity change, is it measuring my humidity?  In any case  valid data appears from the start (although I am ignoring the CRC).

initialising
2,5C,41,D3,20.4 C,65 %
2,5C,41,D3,20.4 C,65 %
2,5C,41,D3,20.4 C,65 %
2,5E,41,A,20.6 C,65 %
2,5C,41,D3,20.4 C,65 %
2,5D,41,27,20.5 C,65 %
2,5B,41,7D,20.3 C,65 %
2,5C,41,D3,20.4 C,65 %
2,5F,42,AD,20.7 C,66 %
2,63,42,AB,21.1 C,66 %
2,66,43,ED,21.4 C,67 %
2,6B,45,B,21.9 C,69 %
2,70,45,7F,22.4 C,69 %
2,74,46,AF,22.8 C,70 %
2,76,47,47,23.0 C,71 %
2,7B,48,29,23.5 C,72 %
2,7C,49,B6,23.6 C,73 %
2,7D,4A,11,23.7 C,74 %
2,7C,4B,D4,23.6 C,75 %

 

So now I need to find out which of my code changes was the correct fix. First thing is that if I now ignore the CRC (in my modified version of the original code which uses SPI) then the values all seem good. Perhaps CRC is incorrectly generated or calculated on the Arduino side.

What I find is that there seems to be no impact between my setup of the SPI and the original so long as I ignore CRC. The only things I find is that the Arduino SS pin is not specified as connected so I assume that it wasn’t when Matthew Little did his experiments. Leaving the SS pin floating seems to introduce random data. Note that I did try leaving the DYPTH CE line low all the time and this causes no issues. Using the CRC code to do a reset causes data problems since we probably aren’t waiting long enough for the reset to occur.

What I found next during my debugging of the CRC generation was that adding extra code to be used to debug the system caused the CRC to be calculated incorrectly. For example when I added the following code I got a different sequence of CRC problems. Believe it or not. I went back and forward, adding and removing this code and always go similar results. So, something seemed very strange.

      Serial.print(" i:");
      Serial.print(i, HEX);
      Serial.print(" b:");
      Serial.print(byt, HEX);
      Serial.print(" c:");
      Serial.print(crc, HEX);  
      Serial.println(">");

To me this seemed like some form of compiler issue or memory corruption due to bad code. I had already looked at changing the datatypes used in the calculation of the CRC getting differences in the process. I then noticed the PROGMEM keyword on the array of CRC values. This seemed suspicious although at this point I had no idea what it meant but I removed it from the next line:

const unsigned char CRC8table[256] PROGMEM = {
to get:
const unsigned char CRC8table[256] = {

And after I did this the crc calculation works consistently – well I always get zero now indicating no errors and at the slow data speed I wouldn’t expect any errors. After investigating PROGMEM I find that it is supposed to put items into flash but was perhaps being used incorrectly as it relies upon a library that doesn’t seem to be being used and also only works with specific data types.

So, in summary, what I found is that the original code was all ok except for the use of PROGMEM. When PROGMEM was used in the definition of the CRC table the calculation of CRC values using the this definition caused some type of memory corruption. This memory corruption led to random errors being seen in the output.

I think I can now get on and start work on the nRF radio transceivers.

Bootstrapping access to space – from the White House

I just saw the post about bootstrapping our access to space via Slashdot and after a long upsetting day at work seeing this and thinking about what it means puts my day (and week) into perspective and makes me feel a little better.  It’s likely that none of these ideas are original and are obvious but I wanted to take the time to send an email even if all it is is just a vote in support of the goal.

The first thing is I believe that it might be the case that a lot of people would work on projects relating to space in return for food and board,  particularly if there is the promise of getting into space at some point in their career.  This isn’t a suggestion to use people as cheap labour but to think about the possibilities of creating extraordinary work environments for these kinds of projects.  Perhaps in a similar model to the idea of the Peace-corps
I also think that getting on board with Lockheed Martin’s recently announced project for a small fusion reactor should be made a priority relating to this project.  If this project pans out as is suggested, particularly given the small size targeted for the reactors there could be a natural match to space technology.
My final point is that it might be worth looking at the individuals who are signing up for a one way ticket to Mars.  That’s the level people will go to to work in space. So I think not everything should be about robotics.

Creating a new audio amplifier part 8.

After a bit of a long delay I’m going to call this finished.  I knew it was all working but it had been in a a testing phase for too long so I made a big effort to get the thing done. I’ve redone a lot of the internal wiring and put the front and back panels on.  These are made of an old server lid and are galvanized 1 mm steel sheet.  I had to cut the strips with a cutoff wheel in an angle grinder so I could then use tin snips.  It would have better to use a guillotine.  Steel is I think better than aluminium, it is stronger and I think it works better at shielding.  When I was testing the amplifier with the computer prior to finishing the panels I was getting some kind of electronic noise coming through, now I get nothing.  (I presume it must have been the graphics card that would generate audible harmonics because the rest of the computer would generate signals outside the audio range).

amp_front_covered

The main heat sinks are made from an old industrial air conditioning controller. The heatsink on the bridge is half a heat sink for some old cpu.  Note that the transformer from the old receiver is shielded, it seems to be very quite. The only issue is that I have no idea of the VA rating of the thing.

amp_from_front

I had to do a fair bit of hacking around on the front inner panel due to my not measuring properly where the pots and the audio were going to protrude.

amp_from_back

 

I’ve also replaced the old power switch with a DPDT and included a mains filter (no idea if that is needed) and a mov directly onto the IEC plug.  The speaker / headphone switch is another 240v switch of about 16 A and to the left is the resistor network for the headphone output.  I tried to make all the wires use plugs to make for easy repair.

amp_over_to_right

The heat sinks for the power amp chips are insulated from the chassis so I need no washers between the metal tabs of the chips.  This means the heat sink is at about -ve 30 something volts I think.  I tried to make the wiring as neat as I could and separate the blocks of function so the inputs are at the front of the amp near the pre-amp and the speaker plugs and headphone socket are along the back. This means the signal travels from low to high around from the front to the right and then through the power amp and then to the rear.  240 v is along the lhs edge and the DC is over to the left.

amp_rear

This is what it once looked like.

Receiver purchased for $10 from the tip.

Receiver purchased for $10 from the tip.

The original components in the receiver

The original components in the receiver

The Cold and Writing

I’m rugged up in the office sitting in front of the computer writing. I have a blanket over my legs and I’m wearing a jacket. I refuse to waste money by using the heater.  Tonight the temperature is supposed to be dropping to -6c.  We’ve had three nights now with temperatures this low.  On the first morning after the first night I found the handbrake on my Astra had frozen so I couldn’t release it.  Now I have to park the car without the handbrake stopping the car against the rock edging of the garden. The only use these horrible rocks ever had.  The ice on the windscreen in the morning seems to be about a millimeter thick and this is the moment the heater fan has chosen to completely fail, I still poke a piece of wood up behind the glove box in a vain attempt to get the thing to go.

I have music on, Awake by Tycho. Sometimes this helps but I have to be careful not to trance out and forget to write.  I think it’s happening at the moment.

I am up to 74,145 words in my book. I want to get somewhere around 90,000 prior to starting the editing.  I have a feeling based upon some editing that I have already done that the size might stay fairly constant even with cutting because fixing things has seemed to need larger replacement chunks.

I read somewhere that its important to make it a regular practice of sitting down to write even if you’re not sure what you’re going to say. And the reason was that if you do have an idea and you aren’t there sitting in front of the computer then you might loose the idea.  And I’ve found this to be true. Sometimes just the act of pushing my fingers down on the keys of the keyboard seems to coerce my brain into action.  So I force myself to sit here even when I feel sick or tired or uncomfortable. Waiting for the ideas to arrive.  And anyway, I miss the characters when I’m away from them too long. I miss her.

Of course its possible everything that I’ve written is worthless but even if that’s true at least I will have done it.  I can almost say that anyway. I’ve written the whole book already, all the way to the end. There are just some gaps I have to fill. Now I better stop, I need to get in at least 500 words before I sleep.

 

 

 

Trac and Subversion on webfaction

Tonight I am trying to setup up both trac (an issue tracking system) and subversion (source code control) on my website which is hosted by webfaction. This is so that a site where I have installed a zentyal server can raise bugs in an orderly fashion. Trac may be overkill and too complex, we will see how it works in practice.

I think my installation is working i.e. I can login to trac and get the raise ticket dialog. Subversion is also working and I can access this from tortoise running locally on my desktop. The strange thing I am seeing is that the documentation of subversion talks about it being easy to create a repository – so I did using the svnadmin command. But this new repository is inaccessible through tortoise. So googling around I discover this (apparently written by webfaction support): “Your svn website would not serve a repo that you created manually in ~/repo. Our control panel can only set up Subversion sites to serve Subversion apps created via the control panel, eg ~/webapps/svn. ”  So I already have the repository that was created by the control panel and don’t need to create one, I can’t do that manually in any case (well in a way that allows me access).  I think I get it now.  On looking again at the webfaction documentation for subversion (not the linked to documents) I don’t see any information about need to manually create the repository.   So I think I have succeded. ?Just need to make some configuration changes to trac to make it look good and show the users how to use it.

 

Open source housing the fantasy – part 3.

So my family and I arranged to meet with 3 builders who were all newly minted owners of a land release. The location was to the north and west of the states capital and about 5 hours drive from home.  These particular builders were also members of the 12 person group who were the instigators of the scheme and were obviously intent upon getting the homes up as quickly as possibly to prove the scheme was viable. They had apparently given themselves 4 months to get enough components together for 6 houses and another 2 months to construct these houses.

So we finally arrived at the first of the builders places. It turned out to be a rented property with a triple garage of which two spaces were totally given over to the various jigs that were used to produce the house parts. The third space was used as storage where a number of the house sections could be seen.  The main impression was of the lack of tools in the workshop. I learned later that the system was engineered so that one of the outcomes was the requirement for the least number of tools,  and part of the construction pipeline included the production of these tools so they need to be fairly simple. There was apparently a ladder of increasing complexity until the finished product was reached.  After a while we all went out to the back of the rented house and sat around a table talking.  One particular question I had was why there wasn’t any reliance on computer controlled tools at all, the answers to this question worried me a bit. Apparently after a fair bit of discussion it was decided that, even through a website was available for design and project management, the system was meant to be able to transition (if required) to situations where computers were not available. That is the system should be usable in the case of a general disintegration of society or more prosaically in areas where cost or lack of infrastructure necessitated simpler methods. At this point I realized that I had seen very few power tools lying about in the workshop.  The argument went something like this: ordinary hand tools could be stored carefully and could last unused for many years and would work without electricity.  And in the worst case once these tools ran out in a disintegrating society it was conceivable that they could be re-made with just the application of knowledge and hard work.  Electrical and further computer controlled electrical tools were at too greater remove from a primitive kind of society even with the knowledge available.  This was not to say that the tools were dumb. There was apparently a lot of clever design involved and a lot of high powered optimization of both material usage and characteristics but the overarching goal was always to make sure the implementation and use of the system could be restarted in lowly circumstances from the specifications and explanations.

So, there was the ‘book’ that described the system (which was freely downloadable) and meant to be transmitted in a similar way to the design of the clock of the long now .  This book was meant to be all that was necessary in order to start up a new house building scheme.   I found that I could purchase the book and download it to my kindle.

I did have a few reservations about the new sense I had of the project however I was pointed towards another online book and web site . Unfortunately I also came upon this stuff. However these people I was speaking with seemed to me to just be interested in providing a way for ordinary people to get housing they could construct themselves where the design and construction methods were informed by the best a technologically advanced society could provide. They were just concerned to make sure that the execution remained possible without a reliance on that society.  To list the main criteria for the system design as I now understood it we have:

1. The use of hand / wind or water powered tools only

2. The minimal set of common parts sufficient for interesting / functional / energy efficient housing

3. The minimal set of jigs and other tools

4. Accuracy of building dependant on the fewest variables possible (for instance advanced geometrical methods to get accurate jigs so that accurate parts can be repeatably made)

5. No reliance on complex materials requiring advanced technology to produce eg plastics.

6. Parts are to be 2 person lift maximum

There was a lot more including sophisticated siting and orientation instructions along with drainage, reclamation, sewage and other systems.   All listed for different climate types – and oddly these climate types and locations were listed for countries all around the world. Apparently these people whom I was speaking with were part of an extended internet based group who had all contributed to the designs from a massively rich fund of technical knowledge. For instance there were apparently experiments going in a university in Germany on a method of producing sheet wood from chips in vats with various chemicals easily obtainable in the countryside.  I had noted that there was a reliance on plywood in the constructed house parts which seemed to me to be a failing – although apparently plywood was invented in the 19th Century and so is not necessarily out of scope for home construction – the difficulty is probably the rotary lathe (which could conceivably be hand operated).

I came away that evening feeling conflicted. On the one hand I was disturbed by the dystopian character of some of the discussions I’d had but on the other hand I felt that a lot of their technical ideas were sound. I really believed they were serious about this project and I was very interested in monitoring the project. Whether my family and I would get involved was another thing. I really wanted to see the final outcome first and I wanted some help in analysing the writings of the group to make certain this endeavour really was based on sound scientific principles and not just the imaginings of a group of dreamers.

 

 

Open source housing – the fantasy, part 2.

After dismissing the open source housing plan as a pipe dream we had spent a year attempting to find a house to buy. And what we found was almost a nightmare. Massivly expensive land prices coupled with detached houses that almost filled the blocks. (As an aside in Australia we are very greedy for space for example  in Germany the average house size is 100 square metres for 3 people, over here we have an average of 227 square meters (2003 census)).  All these homes designed in a similar way but all different but looking like a hodge podge on the typical street.  Nothing really stylish. And all built to the 5 – 6 star energy rating standard  but I suspect not out of any sense of duty or environmental responsibility but just because if you don’t you will find it more difficult to sell the house for a good price, and the quality of the builds, so poor.  Units and townhouses we found were built in a similar manner. And the difference between what is affordable and what is possible… To move upmarket to get a house designed and built to have style and to use energy efficiently we would incur a massive expensive, for example from the same site: standard project homes $900 – $1500 / sqm, architecturally designed homes $2500 – $4000 sqm. So the standard is currently 5 star moving to 6 and a designed home 8 – 9. So this means that if you have the money you are able to save money with an efficient home.   Although we have a dissenting view from the master builders of Australia which is basically saying the 5 star is enough and the law of diminishing returns applies to going for higher star ratings. Also see note below.

In any event that an architecturally designed home was out of reach and due to land prices and cookie cutter design along with poor implementation it seemed that any new home was not that desirable. Older homes seemed to mostly have poor energy ratings (or were too expensive) and the costs of upgrading to a higher energy rating would probably also be prohibitive, particularly with the already huge mortgage.

So I checked in again to the Open Source Housing site – and found to my amazement that they did seem to have got some land.  There were about fifty sites all around the country. The prices seemed amazing but then the catch – the land was only available if all of the chunks were fully subscribed only then could the deal go through and sales could take place.  At this point only 17 sites were fully subscribed. This meant that for our site ie the site closest to where we were able to live, we would have to get together the money to purchase a site and then wait until the chunk was fully subscribed – meanwhile paying of the quite large loan repayments – before even thinking about building. This sounded almost impossible.  Perhaps if the bank would provide help to this scheme. (Joke).

Additionally due to the lack of local subscribers,  the other part of the system, the local collective house parts builders these did not yet exist.  Not all was bad news however as there were some builders in areas about 5 or 6 hours car travel distant.

If you recall the Open Source housing system has two main components: 1) purchasing land tracks (chunks) and removing the costs charged by developers and 2) collectively building the house components in a kind of distributed assembly line where these components are pre-designed to fit together and to build efficient homes. Hopefully with enough variability to be interesting.  In any case now it was possible to visit some of the builders.  No built houses but we could see the components in various states of manufacture and the tools and jigs used to create the components.

* Note:  However it seems that it might be possible to do better for around the same cost:  for example a house with an 8 star rating, whatever happened to this scheme?  Doesn’t seem to have taken off.  We can only hope.

Moved house

We have moved to a house in the southern end of Canberra. I am in a bit of a slowdown mode now I think in a reaction to the amount of effort it took to do the move after 3 years in place we thought was going to be ours for as long as we wanted.  We weren’t really thinking seriously of moving.  I am also off work on long service leave, mainly entertaining my youngest son.  The house is almost finished with unpacking but my workshop is not yet setup properly in the garage, I have the old workbench up on trestles  as I needed to work on building my youngest a new computer for his birthday. I hope to be able to build a proper new bench this weekend, with proper shelves behind instead of the the old bookcase version (the shelves on the bookcase are too narrow).   I can’t really use the old setup as I want to have all the gym equipment setup in the 2 car garage space with enough room to make the space usable.  In the old workshop things were a bit cramped.

Creating a new audio amplifier part 7.

After a long delay I have some more progress photos to show. The power supply is finished and the amp and pre-amp boards are complete. I have briefly powered up the amp board and no issues were found (power rails drop to about 32v from 33v and zero volts on the output.  I could have worked longer tonight but the likelihood is that I might blow something up.  Already getting paranoid about having made some error.  For instance at one point I had turned on the power to check the main supply rails one more time and after I turned the power back I attempted to plug in the power to the amp board, I got a few sparks as the local caps charged up (at least I hope that was what happened)…   As you can see I haven’t tried to make a work of art here. I am more interested in making everything plug-able and hopefully work well and reliably.  There’s a fair bit of work remaining, I have to make up a number of cables for connecting pre-amp power and input / output and controls and switches.  Then I have to figure out how to finish of the case and mount the controls and input / ouput stuff.  I haven’t given much thought to the computer side at all except that this can fit into a gap in the front panel metal work and there is a 10v output in the power supply.  I did get information from the blog about RFI and at the time I had completely forgottten about the computer. (Since my heatsinks are not insulated from the amplifier chips there was concern they would pick up the noise).  We’ll see. Anyway there might be even more delay before the next installment since we are moving house over the next few months.

 

Creating a new audio amplifier part 6.

It has been quite a while since I last posted. I have made some progress, but I hadn’t realized how much work needed to be done. The main problems have been making a mount for the heatsinks, – made worse because I wanted them to be insulated from the chassis – and fitting things into the existing case.Well, in a lot of cases working out how to do this.  I have partially completed the P19 and P88 boards and have a rough idea of how the power supply will be implemented.

Rough power supply layout and board mounting

This is the power supply board showing a vague idea of the locations of some components.  I intend to also mount lm317 lm337 regulators on this board using pieces cut from a CPU heatsink to cool these and the diode bridge. The large terminal block is from the airconditioning equipment that the amplifier heatsinks came from.

 

Aligning the heatsinks

I aligned the heatsinks by clamping as shown with a piece of angle drilled at the distance of the amplifier chips (just fitted into the board not soldered) to make sure the module will fit.  I intend to solder the amplified modules after they are mounted to the heatsinks.

Amplifier positioning

 

 

I clipped the angle to the amplifier modules and then marked the holes prior to drilling. The angle is used to make sure the main heatsinks must stay at the correct distance apart while make the mountings and then when the heatsinks are mounted. After comparing this image with the one from the Elliot Sound site I can see that my heatsinks are easily large enough.

 

 

Heatsinks positioned in the case


At right is shown the heatsinks in their final location. Two cross beams will support them and these will be insulated from the case.

 

 

Partially contructed pre-amp

 

The pre amp board. I did have some problems soldering these boards as they are so small and my eyes have degraded somewhat since the last time I did any soldering. Even with magnifying glasses sometimes I was guessing where to hold the iron.  Luckily I have some lead solder left (I am still using only the second roll I ever bought).

 

I have progressed a little further since these photos were taken. In particular I think I have nearly all the remaining components and have finished the mounts for the heatsinks. I did decide to use plugs for all connections to both boards, this will mean they can be mounted while I layout the wiring since everything will just plug in. Easier for maintenance also. This weekend the rest of the family are going to visit inlaws so I am hoping to get a fair bit done.