Putting Some Smartness Into A Smart Fortwo

I have been a happy owner of a 2006 700cc Smart Fortwo since last Summer. But I have been want to put some automation to it for a while. I started my endeavor to making windows open even when ignition is off. There is easy to  follow instruction on the net.

I plan to have a spesific feature which for example a coupe BMW has. When door is opened, door window automatically lowers a bit and when closing the door, window goes automatically up. I want it because every time I close the door I feel overpressure in the cabin. It seems there is no pressure relieve valve like in more ordinary cars. Windshield is the biggest window in the car and because overpressure the sealing of it get much stress when closing doors. A very common problem with Smart Fortwo is a leaking winshield. My car had it also. I think that leaking is caused by overpressure. Luckily I managed to find leakage before my control unit got wet. By the way, that control unit controls pretty much everything in this car so it really should stay dry. It is located below dashboard so it easily get wet if windshield leaks.

That window feature is not implemented yet but I have made some testing. Maybe I’ll write something about it when it is done.

At the moment I just finished a very early alpha version of the control of seat heating. A small microcontroller(Arduino) controls with relays contact pads of seat heater switches. It puts them on automatically when head lights are switched on. After 30 seconds it puts them off and they stays off until lights are cycled off and on again. Convenient! Heating time is short because heating element is so powerful.

As I want more, I equipped control system with a rotary encoder, a temperature sensor and an LCD. My plan is that user can control various variables in the system, for example heating time. And of course temperature depended heating. When environment is warm enough one do not want his/hers seat to be heatened! LCD can display temperature readings and/or how much heating time is left.

Here are some pics taken during the process:

The initial plan was to install everything here.

001-Environment-20160324_180158

Started to work by removing the Safety Triangle and dissassembling it.

002-Triangle-20160219_008

The journey continues by re-engineering.

003-Re-engineering_traces_20160218_003

The very first version of connection board.

004-First-revision-of-conn-board-20160303_013

Here one can see it from another side. I planned to use PC817 optocouplers for isolation but along the way I switched to relays. More on that later. I took the liberty to use USB-connector for connection with car’s electric system. D9 is for rotary encoder.

006-First-revision-of-conn-board-with-PC817_opto-20160312_075803

This is a starting point for house making to rotary encoder. Black case is from an old wall charger for Nokia mobile phone. Knob is from an old car stereo or something like that.

007-Rotary-control-knob-20160220_003

Here is a rotary encoder soldered in place. When I was continuing this build I realized that I should have put rotary the other way around, three legs pointing to left instead what it is now. Well, it happens to all of us..

008a-Rotary-progress-20160220_006

I also had to install capacitors to reduce interference. It still needs something, readings are not reliable enough.

008-Caps-for-encoder-20160313_103113

There is something in the mess, I rarely see a workbench which is tidy and clean. Hmm, except Quin Dunki’s bench. Her work is amazing.

Anyway, some progress has achieved.

012a-Testing-20160312_101144

This is my power supply. In it’s early life it served as 12V mobile phone charger. Through this I can safely use my small embedded systems in electrycally noisy car environment.

012-PSU-20160311_162310

This is my new connection board equipped with relays. As mentioned, previous plan was to use optocouplers. I did not managet to get them work, maybe because of some my stupid coding error. Anyway, I switched to relays.

Those relays “push” the triangle’s buttons when commanded by Arduino. Smart has conveniently system I like very much: Pushbutton is ON-OFF state information for car’s computer instead of some resistance change. This way relays can be used to “push” buttons.

From left to right connectors are: Black: Temperature probe connection, USB: Power to my system and controlling buttons and D9 is for rotary as earlier mentioned. Temperature connector in salvaged from an old PC’s motherboard. It is an audio connector. In the future there might be coming a minor problem with D9. In the end of cable is a quite heavy connector and stiff car’s suspension combined with that weight might do some issues by removing solder joints during time. That is to be seen.

015-Conn-board-rev_2-20160320_094237

This is a starting point for facade. The white plate is salvaged from an old laptop LCD monitor.

017-Starting-to-make-frontplate-20160312_083032

And here we are: Casing for encoder is ready, temperature sensor(red thing) is ready, main unit is ready. Now it only needs to be installed. And it maybe need some clever programming also. Now it is only a timer ) :

018-Assembled-20160324_174743

This is only temporarily mock-up.

020-Fitting-20160324_202349

From another angle. When thinking how to install main unit on top of dashboard wisely(read: do not drill holes in that dashboard) I got an idea: Why not make a console in front of gear stick and stuff the whole system inside it? That way there is room for that earlier mentioned window-control also.

Yes, that is a good idea. But then again that means a lot of work and no automated seat heaters yet. And Summer is coming. Also, I finally want to enjoy the work of my hands. It has been a long building process. What to do? Naturally install the system. Temporarily, of course. ūüėČ

Encoder is located beside the gear stick. Temperature sensor is on the floor, for now. Wires needs to be sorted. But it works. Hooray!

021-Another-view-of-fitting-20160324_202440

Here is a link for video

That’s all for now!

 

 

 

 

Advertisements

Arduino, LCD and DS1820

As I mentioned in previous post, I might use those DS1820-sensors. And I did. Platform is the same, but enhanced by one little but mighty sensor. (Actually that sensor can be seen in previous post also.) Those little things are packed full of technology. They look like an ordinary transistor but that fools you a lot. They measure temperature quite a wide range (‚Äď55¬įC to +125¬įC) and convert analog readings to digital in no time. Multiple sensor can work in the same line because every one of them have it’s own unique serial number. They have also some other tricks in their sleeve, your favorite search engine will tell to you¬†a lot about them.

When measured temperature is already converted to digital values, it is easy to get those values to Arduino, for example. Code is in Git. Code is released under gnu gpl 3 and is patched together from others contribution with a little bit of my own code.

This apparatus measure temperature values and shows them in Celsius degrees in LCD. Video below.

 

Arduino, LCD, Rotary Encoder and Ikea USB-LED

Update 21.5.2014: Here is the source code: https://github.com/renerento

Yes, Arduino, a piece of electronics that divides people. Some of us like it and some of us hate it. I like it.
Some time ago I bought 2 Arduinos at once and started to play with them. At first my¬†goal was connect an Arduino to LCD and display some data on it. Then I realized that I have a rotary encoder and it would be fun to use that component as well. I digged code snippets from internet and found many ways to connect a rotary encoder to Arduino. Some of them used external capasitors for debouncing and I did not like that. Then I found Ben Buxton’s home page and used part of his code to make things click.

I also had some DS1820 temperature probes lying around and I decided to connect also them to Arduino. Maybe later more about that topic.

I found a simple aluminum enclosure. I modified it a bit for my components to fit in and started coding. As I am not a real coder, I simply searched code from the internet and modified it to suit for my applications.

This code does following:

When powered on string on LCD is displayed “LED dimming test”. After that display goes blank. When one rotates encoder¬†LCD shows either string “Minimum value reached!” or¬†up going numbers. Simultaneously with up going numbers the USB LED from Ikea¬†starts to shine. The more the numbers grow the more LED shine, until it reaches the max value. When that happens¬†LCD says “Maximum value reached!” User can decrease or increase the level of the numbers and¬†brightness simple rotating encoder. Numbers change 5 unit per one encoder click, min is of course 0, max is 255.

 

Here are some pics and video.

LED_Dimming_Arduino_And_LCD_01

LED_Dimming_Arduino_And_LCD_02

LED_Dimming_Arduino_And_LCD_03