Categories
programming

Geany dark editor in Ubuntu – configure a dark colored theme / style

Geany dark Editor – configure an alternate dark color theme

general

My applications running under Ubuntu (As of today 1/2017 Version 14.10) with the window manager Unity and the Ubuntu standard GTK + theme Ambiance.

It is possible to select different styles in Unity, but the dark themes are looking not so nice across all applications.
Especially with the Internet browsers, I think dark themes are not suitable.

However, it is possible to start applications with individual selected ‘color’ themes.
In order to let geany look as shown in the picture further below, I proceeded as follows.

step by step

  • install geany, if not already present -> sudo apt-get install geany

editor internal

  • If there should be no color themes available in geany, download them here: https://github.com/geany/geany-themes/
  • copy the folder colorschemes into ~/.config/geany/
  • now you can choose in geany from View -> Editor -> Color Themes – Color Themes your preferred Theme
    I use ‘raspberry’.geany dark - farbauswahl

Editor outside area

As described in http://www.henrykoch.de/de/eclipse-programmierumgebung-dunkel-machen, I build on an existing dark GTK+ theme and have modified this for me.
The following informations I stored as file .gtkrc_dark in ~/home/…/ (choose a convinient place for you)

gtk-color-scheme = "base_color:#252525\nfg_color:#f0f0f0\ntooltip_fg_color:#252525\nselected_bg_color:#FFD587\nselected_fg_color:#252525\ntext_color:#dadada\nbg_color:#4d4d4d\ntooltip_bg_color:#FFA500\nlink_color:#494949"
style "gtkcompact" {
	font_name="Sans 11"
	GtkButton::default_border={0,0,0,0}
	GtkButton::default_outside_border={0,0,0,0}
	GtkButtonBox::child_min_width=0
	GtkButtonBox::child_min_heigth=0
	GtkButtonBox::child_internal_pad_x=0
	GtkButtonBox::child_internal_pad_y=0
	GtkMenu::vertical-padding=1
	GtkMenuBar::internal_padding=0
	GtkMenuItem::horizontal_padding=4
	GtkToolbar::internal-padding=0
	GtkToolbar::space-size=0
	GtkOptionMenu::indicator_size=0
	GtkOptionMenu::indicator_spacing=0
	GtkPaned::handle_size=4
	GtkRange::trough_border=0
	GtkRange::stepper_spacing=0
	GtkScale::value_spacing=0
	GtkScrolledWindow::scrollbar_spacing=0
	GtkExpander::expander_size=10
	GtkExpander::expander_spacing=0
	GtkTreeView::vertical-separator=0
	GtkTreeView::horizontal-separator=0
	GtkTreeView::expander-size=8
	GtkTreeView::fixed-height-mode=TRUE
	GtkWidget::focus_padding=0
 
	####################
	# Color Definitions
	####################
 
	bg[NORMAL]= @bg_color
	bg[PRELIGHT]  = shade (1.02, @bg_color)
	bg[SELECTED]  = @selected_bg_color
	bg[INSENSITIVE]   = shade (0.95, @bg_color)
	bg[ACTIVE]= shade (0.9, @bg_color)
	fg[NORMAL]= @fg_color
	fg[PRELIGHT]  = @fg_color
	fg[SELECTED]  = @selected_fg_color
	fg[INSENSITIVE]   = darker (@bg_color)
	fg[ACTIVE]= @fg_color
	text[NORMAL]  = @text_color
	text[PRELIGHT]= @text_color
	text[SELECTED]= @selected_fg_color
	text[INSENSITIVE] = shade (0.8, @bg_color)
	text[ACTIVE]  = darker (@text_color)
	base[NORMAL]  = @base_color
	base[PRELIGHT]= shade (0.98, @bg_color)
	base[SELECTED]= @selected_bg_color
	base[INSENSITIVE] = shade (0.97, @bg_color)
	base[ACTIVE]  = shade (0.94, @bg_color)
 
}
 
class "GtkWidget" style "gtkcompact"
style "gtkcompactextra" {
	xthickness=0
	ythickness=0
}
 
class "GtkButton" style "gtkcompactextra"
class "GtkToolbar" style "gtkcompactextra"
class "GtkPaned" style "gtkcompactextra"

To start, I still need a bash script:

#!/bin/sh
export GTK2_RC_FILES="/home/.../.gtkrc_dark"
geany $1
env --unset=GTK2_RC_FILES

In addition, I have built a small dark geany logo and also stored under /home/…/ . (the 3 files as zip file geanydarkfiles.zip)

The last action must be performed with root privileges: sudo gedit /usr/share/applications/geany.desktop

Adjust the following two entries:

Exec=/home/.../geany.sh %F
Icon=/home/.../geany.xpm

Now Geany can always be called in dark, without having to start it from a console so it becomes dark. geany dark aufruf

geany dark Editor dunkel - dark

Speed control with Arduino PWM – Papbst ebm G1G133-DE19-15* fan

Speed control with Arduino

Fortunately, I still had some ‘power electronics’ from my experiments with an alternator in the toolbox.
With the used MOSFET transistor, it is definitely no problem to switch 24V / 2A.
Pulse width modulation with Arduino is ‘normally’ implemented with one single command.

Video of the test run

Code Arduino Sketch

A single instruction and Arduino outputs a PWM signal.
The standard PWM frequency of 62500 HZ was not suitable for braking the fan in its run.
This caused me that the engine depending on the pulse width was either on or off.
I think times the reason is the fan motor itself, which in itself is equipped with a lot of control electronics.
With the instruction: TCCR1B = TCCR1B & 0b11111000 | 0x03; I set the PWM frequency down to nearly 500 HZ. further information: http://forum.arduino.cc/index.php?topic=16612#msg121031

int Luefter = 10;          // the PWM pin the Luefter is attached to
int sensorValue = 250;
int oldsensorValue = 0;
volatile unsigned long count;
 
 
// the setup routine runs once when you press reset:
void setup() {
    //PWM Frequenz runter regeln
    //http://forum.arduino.cc/index.php?topic=16612#msg121031
    TCCR1B = TCCR1B & 0b11111000 | 0x03; //PWM Frequenz Pin10 - 488.28125 Hz Standard 31250 / 64
 
    Serial.begin(9600);
 
    // declare pin 'Luefter' to be an output:
    pinMode(Luefter, OUTPUT);
 
    setPwmFrequency(Luefter,32);
    analogWrite(Luefter, sensorValue);
}
// the loop routine runs over and over again forever:
void loop() {
 
 
  sensorValue = analogRead(A0)/4;
  if ( sensorValue > oldsensorValue + 1 || sensorValue < oldsensorValue - 1 ) {
    //print out the value you read:
    Serial.print("PWM------");
    Serial.println(sensorValue);
    analogWrite(Luefter, sensorValue);
 
    oldsensorValue = sensorValue;
  }
  count=0;
  delay(2000);
  Serial.print("gemessen-u/min--");
  Serial.println(count*15);
  delay(1);
}

Restless run at middle speed

As can be seen in the video, the engine runs normally at low speeds (up to 300 rpm) and at higher speeds (from 1500).
The engine does not run smoothly in between.  On the following page, I test stabilizing the voltage with an elko.
The included technology in the motor itself makes this relatively simple solution of the control with a PWM signal nearly impossible..

Papst ebm G1G133-DE19-15* fan speed measuring / controlling with Arduino and Raspberry Pi

On ebay are offered used fan with DC motors from 13 euro, which with up to air flow: 225 m³ per hour with a maximum of 45 watts have very good performance values.
For me it was important that it is possible to regulate the speed of the fan, because I don’t always need full power.

In the reviews of the product below in the auction, it was announced that the speed of the motor can be controlled by PWM.
This data sheet of an almost identical fan shows on page 4 that it is possible to control the speed via a PWM signal. With my fan this doesn’t work.

After many attempts to create a PWM signal and to pick up a speed pulse, I decided to take the fan apart.

Inside it is not a normal DC motor, that is more a microcontroller-controlled high-tech product. I am sure that the circuitry would allow speed control even if for that the internal fan microcontroller’s code would have to be adapted.

continuing on the following pages:

Categories
Raspberry Pi

Raspberry Pi – using the serial interface (RS232)

The Raspberry Pi is equipped with many interfaces.
And the possibilities can rise more than exponentially by using of the USB port.
But to communicate with AVR microcontrollers is the best suited way by using a serial interface.
Of course, the Raspberry Pi A has a serial interface, but unfortunately merely as pins on the GPIO connector.

The required pins, could be connected theoretically directly to the microcontroller eg. ATMega8.
But that would require that the microcontroller operates at 3.3 volts.
My Pollin evaluation board works with 5 volts, but is made with a complete RS232 interface for communication with PC or other equipment.
The easiest way would it be, when the Pi would have an RS232 interface like a PC with the same connectors and signal levels.
By Googling I’ve found the website Serial Port Add On.
The described Serial Port to TTL Digital Converter Module there, I’ve bought at Ebay.

GPIO Header Pins
RaspberryPI_GPIO_serielle_Schnittstelle
2 4 6 8 10 12 14 16 18 20 22 24 26
1 3 5 7 9 11 13 15 17 19 21 23 25
1= 3.3V, 9= GND, 8= TX, 10= RX

The jumper cables to connect to the Raspberry Pi were included in the delivery.
I’ve connected the module with the Pi, as shown in the picture below.

To get the serial interface up and running, are some changes in/etc/inittab and /boot/cmdline.txt necessary.

/etc/inittab

  • comment line: ‘T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100’
#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

/boot/cmdline.txt

  • delete of: dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

pictures of my PI inclusive ‘serial device’

RaspberryPI_mit_serieller_Schnittstelle_VS RaspberryPI_GPIO_serielle_Schnittstelle1_VS RaspberryPI_GPIO_serielle_Schnittstelle2_VS RaspberryPI_GPIO_serielle_Schnittstelle3_VS RaspberryPI_GPIO_serielle_Schnittstelle4_VS

Video, for Demonstration

The video is already on my ‘Hello World Example’ in the ATMega8 area of my website in use.

For that I’ve written a little perl script. Surely it is possible to use programs like minicom, but I dont wanted to spend the time to familiarize myself with a new tool.
The script was written faster and from my perspective it’s much more flexible for further use and for experiments.

selfmade Wooden Generator 1 – Experiment 2 with rectifier

Wooden Generator 1 with rectifier

Based on Wooden Generator Experiment 1, the circuit was now extended by a bridge rectifier.

For this I used BAT48 Schottky diodes because they consume only 0.2 volts.
A 1000 μF electrolytic capacitor is used as a stabilizing element.
The capacitor buffers the whole a little and the LED should light up longer and more stable.
With a small LED as a consumer, I get a current of approx. 5 mA and a voltage of approx. 1.7 V with fast speeds.
The result is a proud performance of 8.5 milliwatts.
So there is still much room for improvement :-)

Wooden Generator Schaltplan Experiment 2 Wooden Generator Versuchsaufbau Exeperiment 2

The following video gives a brief impression of the rather poor yield.

https://youtube.com/watch?v=SH9jxq0oGrw%26hl%3Den%26fs%3D1

(Deutsch) Wooden Generator 1 – Experiment 1

Sorry, this entry is only available in German.

Dimensioning – own construction VAWT vertical axis wind turbine

From the beginning I wanted to build a vertically running wind turbine since it does not have to be oriented towards the wind. A vertical turbine usually starts at low wind speeds and withstand strong winds.

For vertical turbines there are several popular approaches, such as the Darrieus rotor, the Savonius rotor and various modifications.
Since I do not have the tools and possibilities of a production company as a private person, the rotor should be as simple as possible from the structure, so that I am able to implement it from home.
After much research on the net, I found an Excel list for dimensioning a Lenz2 rotor.

According to the inventor of the wing profile, it has a quite high efficiency, with manageable construction complexity.

Now, where it was clarified, what kind of rotor it should become, the dimensions had to be determined.
As can be inferred from this study, the average wind speed in Saxony is 10 meters above the ground at approx. 5 m / s.
My windmill is about 4 – 5 meters above the ground and at a distance of about 10 meters there are a few bushes, which surmount the wind wheel.
So the 5 m / s average wind speed is not achievable.
My assumption is an average wind speed of 3m / s, which would be immediately the end for a location for a productive plant.
But unfortunately I don’t have a beach property with 10 meters high mast available.

The wind turbine is supposed to feed a significant output of more than 10 KW / h per year into the battery. This is much more than I could generate in 2012 with my small solar cells.
I’ve played a little with the Excel list for the dimensioning of Lenz2 rotors around and I decided at the end for 70cm diameter and 70cm height with 3 wings.
This corresponds to almost half a square meter area where air flows through.
If I assume the 2.65 watts, which can be generated with the 70/70 rotor at average 3m / s within a year, I come to 23.2 KWh per year. This is equivalent to 3.5 times my electricity generation from 2012.

Calculated output (according to Lenz)
Wind speed km/h Wind speed m/s Speed loaded rpm Speed idle rpm Electrical power in W
4 1 22 44 0,10
7 2 44 87 0,79
11 3 65 131 2,65
14 4 87 175 6,29
18 5 109 218 12,28
22 6 131 262 21,22
25 7 153 306 33,70
29 8 175 349 50,30
32 9 196 393 71,62
36 10 218 437 98,25
40 11 240 480 130,77
43 12 262 524 169,78
47 13 284 567 215,86
50 14 306 611 269,60
54 15 327 655 331,59
58 16 349 698 402,43
61 17 371 742 482,70
65 18 393 786 573,00
68 19 415 829 673,90
72 20 437 873 786,00
76 21 458 917 909,90
79 22 480 960 1.046,17
83 23 502 1004 1.195,41
86 24 524 1048 1.358,21
90 25 546 1091 1.535,16
94 26 567 1135 1.726,85
97 27 589 1179 1.933,86
101 28 611 1222 2.156,79
104 29 633 1266 2.396,22
108 30 655 1310 2.652,76
112 31 677 1353 2.926,97
115 32 698 1397 3.219,46
119 33 720 1441 3.530,82
122 34 742 1484 3.861,63
126 35 764 1528 4.212,48
130 36 786 1572 4.583,96
133 37 808 1615 4.976,67
137 38 829 1659 5.391,19
140 39 851 1702 5.828,11
144 40 873 1746 6.288,01
Rotor diameter: 0,7 m
Rotor height: 0,7 m
Number of blades: 3 pcs
Efficiency according to Lenz: 41 %
Efficiency generator: 80 %

The 2.65 watts are, however, also the lower end of the scale as far as power generation is concerned.
The generator should perform well in the speed range 60 – 500 rpm.
Typically, the power that can be delivered should increase as described in the table.

Radius of the slats: 66 mm
Length entire blade: 280 mm

A look at the back of the table, but also shows what can work beyond the 15m / s for forces.
On one site, the wind turbine does not provide much more than 20 KW / h per year, but the design must be stable enough to withstand several thousand watts of wind power.
The lighter the construction is, the better.
It is relatively easy to see that such a project has a certain claim.

I have decided to use aluminum for the construction of the rotor, since this on the one hand it is a lightweight material and on the other has not to be protected against corrosion.
Aluminum is available anodised. I chose brown colored metal sheets, because it dark colors are reflecting very little sunlight from my point of view.
Naked aluminum looks like a mirror and I do not want to risk that the neighbors will be disturbed by sunshine reflections.
Except for the mast, I trust glue and screw connections.
The wing profiles are glued with UHU Endfest 300 (300 Kg / cm² adhesive force).
The connections up to the hub are screwed so that there is the possibility to align the rotor, since at relatively high revolutions a unbalance would lead to problems.
The structure in detail I will explain in the following pages (see page navigation – top right of the page).

And finally the drawing of the profile started with the project 2011:

Zeichnung Fluegelprofil

(Deutsch) Kreissägeblatt – Generator – Experiment 1

Sorry, this entry is only available in German.

selfmade disc generator on circular saw blade – electric power generation

Sorry, this entry is only available in German.

(Deutsch) Eigenbau Wooden Generator 1

Sorry, this entry is only available in German.