Een blog over dingen die je met computers kan doen, lopen, fietsen, natuur, foto's, .... Ramblings about things to do with computers, bikes, nature, pics, ...
dinsdag 31 oktober 2017
Learning (micro)python by creating a class to read an max17043 lipo fuelgauge
The pycom micropython modules (https://www.pycom.io) are little IOT modules with lots of IO-pins, LiPo battery connecter/charger, wifi, bluetooth (and lora on selected models). They are comparable with the Arduino Mkr1000 family, except you program them with (micro)python. They are great for battery operated little things.
To get back up to speed with python, I've created this little library to read out a maxim max17043 lipo fuelgauge, so you can see how much energy there is left in the LiPo battery. This is chip is used on this little board from Sparkfun ( https://www.sparkfun.com/products/10617 ).
The library is based upon this library from Luca Dentella ( https://github.com/lucadentella/ArduinoLib_MAX17043 )
My library: https://github.com/andrethemac/max17043.py
donderdag 15 december 2016
nextcloud 10, centos 7 and rh-php56
It 's easy to run, manage and use.
It got great apps on android and linux.
I'v been running owncloud on debian but recently decided to change to centos 7.
Moving nextcloud was easy, but centos 7 comes with PHP54.
So Ive tried to upgrade PHP to 56, but that was not as easy as I tought.
In the end I got it running with these.
sudo yum install rh-php56-php-mbstring rh-php56-php-gd rh-php56-php-pdo rh-php56-php-xml rh-php56-php-pear wget bzip2 curl rh-php56-php rh-php56-php-mysqlnd
cd /etc/httpd/conf.modules.d
sudo mv 10-php54-php.conf 10-php54-php.old
sudo mv 10-php.conf 10-php.old
cd /etc/httpd/modules
sudo ln -s /opt/rh/httpd24/root/usr/lib64/httpd/modules/librh-php56-php5.so .
sudo apacheclt restart
I got the site running, then I got these errors
Can't write into config directory!
This can usually be fixed by giving the webserver write access to the config directory.
but these too saved my day.
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud(/.*)?'; restorecon -RF /var/www/html/nextcloud/
semanage fcontext -a -t httpd_sys_rw_content_t '/data(/.*)?'; restorecon -RF /data/
zondag 27 november 2016
weekender project: build a clock out of a plastic jar.
Make a clock with a white plastic jar, 2 adafruits neopixel rings and an arduino.
you need
1 arduino uno
1 adafruit neopixel ring 24 color leds (link)
1 adafruit neopixel ring 12 color leds (link)
1 plastic jar with lid, big enough to hold the 24 leds ring.
1 rtc module (real time clock) like this one (link)
The small ring is the small hand of a clock. 12 led's for 12 hours.
the bigger ring show's the seconds an minutes. well 2.5 minutes (seconds). Because 60 minutes diveded by 24 leds is 2.5 minutes interval. This makes the clock less accurate to read. Adafruit sels 60 led ring but it's huge, too huge.
The seconds go round in smooth way. They start to fade in and fade back out, one after another to create a fluid motion.
The minute and hour "hand" don't have this motion (yet).
The color of the hour and minute leds change during the day. At midnight till about 4 they are blue, then they start to fade to red at dusk continue to yellow at noon, in the late afternoon they fade back to orange, red, purple and blue to emulate the dawn.
The code.
You can find the code on github (link).puzzling the pieces together
The neopixel rings are easy to put together. The rings need only 3 wires: 5v, ground and a data line. Run a wire from pin 6 on the arduino to the data in of the 24 led pin and a wire from de data out of the 24 led ring to the data in of the 12 led ring. Connect the 5 volt and ground.The rtc module needs 5 wires: 5 volt, ground, mosi, miso and ss. They are connect to pins 10-13.
The jar.
you need a white plastic jar. The neopixels are bright. A white jar kind of smooth out the bright light.![]() |
| the neo pixel ring front |
![]() |
| neopixel rings atached to a small piece of wood |
![]() |
| in the jar |
![]() | ||
| the arduino and the rtc mounted in the lid of the jar |
what's still missing
Button's to adjust the time. I had no right size switches of button's left, so adjusting the time can't be done without connecting the arduino to the computer and recompile the code.zaterdag 12 maart 2016
using Wipy, Sim800 GRPS GMS modem, DHT11 temp sensor and micropython
using a SIM800 GSM board to send a warning when temperature drops below zero degreesor when a button gets pushed on the blynk
blynk by blynk (http://www.blynk.cc)
blynklib by danicampora ( https://github.com/wipy/wipy/blob/master/lib/blynk/BlynkLib.py )
untplib by andrewmk ( https://github.com/andrewmk/untplib )
DHT decoder by RinusW (http://forum.micropython.org/viewtopic.php?t=1392)
(inexpensive) SIM800L GPRS GSM Module SIM Board QUAD BAND Antenna for MCU Arduino (and wipy, ...)
mashup by me andre@andrehtemac.be
todo sim800 communication needs more work
2016/03/12 : version 0.1
see the code on:
https://github.com/andrethemac/wipyDHTSIM800.git
zondag 3 november 2013
Deluxe thermometer with ethnernet and logging and adafruit neopixel display
A weekend project.
1 arduino ethernet
1 adafruit neopixel shield 8x5.
1 sht15 temperature senson
1 pressure sensor
some wire
How to wire up is explained in the ino file in github.
There are good wikis on the setup of the lighttp server, Python examples and mysql info too.
The neopixel can put a huge load on the power supply. You have to take care about that. By keeping the brightness rather low, the shield draws no more than 60 mA (a shield on full blast goes easy over 1A).
Putting a piece of paper before the neopixels makes the display more readable and clearer. (or a piece of plexiglass would do the same, just don't use a crystal clear one).
The bar graph takes 8 hours to fill up, so be patient.
zaterdag 11 mei 2013
arduino based thermometer with lcd display and logging
some images

Things it should do
measures the temperature (obvious)sends data to a webserver (and a database)
show the temperature on a display
tell's if the temperature is rising of dropping over the last
10 minutes.
Display should only work if there's somebody close to the display. This is done by using de arduino's pins to power the LCD backlight.
The backlight controlling pin goes high (backlight on) when another pin goes hight. This other pin is connect to a digital motion sensor.
materials used:
1 arduino with built in ethernethttp://arduino.cc/en/Main/ArduinoBoardEthernet
library
http://arduino.cc/en/Reference/Ethernet
1 digital motion sensor
http://www.ladyada.net/learn/sensors/pir.html
http://iprototype.be/search?search_string=pir
1 lcd 2 x 16 characters based on a Hitachi HD44780 chipset
http://iprototype.be/products/components/led-lcd/lcd16x2-BL
library:
http://arduino.cc/en/Reference/LiquidCrystal
1 NTC (temperature sensitive resistor)
http://iprototype.be/products/components/sensors/ntc
little extra: measuring light
1 ldr (light sensitive resistor)
1 breadboard and a lot of wire
steps
connect the display to the arduinoVSS connects to ground
VDD connects to +5 v
v0 connect to the slider of a 10K potentiometer (one side on the 5V, the other on the ground) RS connects to arduino D7
R/W connects to ground
E connects to arduino D6
D4-D8 connects to arduino D2-D5 (data)
K of backlight connects to ground
A of backlight connects to arduino D9
Digital Motion Sensor (pir)
connect the Red and black wires to the 5v and ground, connect the data wire to the arduino D8.
NTC
NTC is a negative temperature controller, a resistor whose value changes with the temperature. A 10K resitor is used as a pullup resistor. The analoge input (A0) is connected between the NTC and the 10 K resistor
5V --[10K]-- A0 --[NTC]-- ground.
logging the webserver.
On the webserver a cgi script for the arduino.
The script is written in python. This script passed the values on to a database.
how the breadboard was setup
Fritzing schema : Fritzing
the code
you can download the code here: temp4.ino
/*
Andre Peeters
2013-05-11
Deluxe thermometer v0.2
measures the temperature
sends this to a webserver (and a database)
also shows the temperature on a display
tell's if the temperature is rising of dropping over the last
10 minutes.
Only shows its value if there's somebody close to the display.
(digital motion sensor)
materials used:
1 arduino with built in ethernet
http://arduino.cc/en/Main/ArduinoBoardEthernet
library
http://arduino.cc/en/Reference/Ethernet
1 digital motion sensor
http://www.ladyada.net/learn/sensors/pir.html
1 lcd 2 x 16 characters based on a Hitachi HD44780 chipset
http://iprototype.be/products/components/led-lcd/lcd16x2-BL
library:
http://arduino.cc/en/Reference/LiquidCrystal
1 NTC (temperature sensitive resistor)
http://iprototype.be/products/components/sensors/ntc
1 ldr (light sensitive resistor)
1 breadboard and a lot of wire
*/
/*
ethernet setup
*/
#include
#include
#include
// my mac address
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x8E, 0x23 };
//medion = my server's dns name
//byte medion[] = { 192, 168, 128, 17 };
char medion[] = "medion";
EthernetClient client; //(medion, 80);
// msg to send to server
String msg;
/*
display setup
*/
// include the library code:
#include
// celsius character
byte celcius[8] = {
B00110,
B01001,
B01001,
B00110,
B00000,
B00000,
B00000,
};
// arrow up character
byte up[8] = {
B00000,
B00100,
B01110,
B10101,
B00100,
B00100,
B00000,
};
// arrow down character
byte down[8] = {
B00000,
B00100,
B00100,
B10101,
B01110,
B00100,
B00000,
};
// line character
byte equal[8] = {
B00000,
B00000,
B00000,
B11111,
B00000,
B00000,
B00000,
};
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
//pir (digital movement sensor)
#define pirIn 8
// lcd backlight control
#define backLight 9
// temperature
float temp;
int light;
int tempArray[] = {0,0,0,0,0,0,0,0,0,0};
int tempAverage;
int t;
//Temp and light sensor
#define InputTemp 0
#define InputLight 1
/*
convert the value messured on the NTR resistor
to celsius degree temperature
*/
// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 4100
// the value of the 'other' resistor
#define SERIESRESISTOR 10000
double Thermister(int RawADC) {
float average;
average = 1023.0 / RawADC - 1;
average = SERIESRESISTOR / average;
float steinhart;
steinhart = average / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // convert to C
return steinhart;
}
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("initial setup");
lcd.setCursor(0,1);
lcd.print("please wait");
// create the special chars
lcd.createChar(0,celcius);
lcd.createChar(1,up);
lcd.createChar(2,down);
lcd.createChar(3,equal);
// set the digital pins
pinMode(pirIn,INPUT);
pinMode(backLight,OUTPUT);
digitalWrite(backLight,HIGH);
Serial.begin(9600);
// init temp
temp = 0.0;
light = 0;
// ethernet setup
// configure dhcp
if ( Ethernet.begin(mac) == 0 ) {
Serial.println("failed to configure dhcp");
for ( ;; )
;
}
else {
// this is my IP address
Serial.println( Ethernet.localIP() );
}
// clear the lcd when setup is done
lcd.clear();
}
void loop() {
// get the temperature
temp = Thermister(analogRead(InputTemp));
// keep the last 10 mesure values as an int
int tt = temp * 100;
// shift the values in the array to the front and add the actual
// temperatur at the back
for(int x = 1; x < 10; x++) {
// replace a zero value in the array with the actual temperatur
if(tempArray[x] == 0) {
tempArray[x] = tt;
}
tempArray[x-1] = tempArray[x];
}
tempArray[9] = tt;
// calculate the average temperature over the last 10 mesurements
tempAverage = 0;
for(int x = 0; x < 10; x++) {
tempAverage = tempAverage + tempArray[x] ;
}
tempAverage = tempAverage / 10;
// create a string with the temperature with 2 numbers after the
// decimal point
t = temp * 100;
int t1 = t / 100;
int t2 = t % 100;
String ts = "";
if(t2 < 10) {
ts = "0";
}
String t0 = "";
t0 = t0 + t1 + "." + ts + t2;
// convert the light to a number
light = constrain(map(analogRead(InputLight),0,250,0,100),0,100);
int l = light;
// get things on the display
lcd.setCursor(5,0);
lcd.print(t0);
lcd.write(byte(0));
lcd.setCursor(15,0);
if ( tempAverage == tt) {
lcd.write(byte(3));
lcd.setCursor(0,1);
lcd.print(" gelijk ");
//lcd.print(" equal ");
}
if ( tempAverage < tt) {
lcd.write(byte(1));
lcd.setCursor(0,1);
lcd.print(" stijgend ");
//lcd.print(" rising ");
}
if ( tempAverage > tt) {
lcd.write(byte(2));
lcd.setCursor(0,1);
lcd.print(" dalend ");
//lcd.print(" dropping ");
}
/*
lcd.setCursor(0,1);
lcd.print("light = ");
lcd.print(l,DEC);
*/
//send the temperature messured to the webserver and database
String msg = "GET /cgi-bin/t2.py?t=";
String msg2 = "&l=";
String msg3 = " HTTP/1.0";
msg = msg + t0 + msg2 + l + msg3;
client.connect(medion,80);
if (client.connected()){
Serial.println("connected");
client.println(msg);
client.println();
client.stop();
} else {
Serial.println("error");
}
client.stop();
/*
wait a second an check the motion sensor
if there is motion, turn on the display and the backlight
repeat this for a minute, then measure the temperature again.
*/
for(int x = 0; x < 60; x++) {
//read pir and turn on the backlight if oké
if(digitalRead(pirIn)) {
lcd.display();
digitalWrite(backLight,HIGH);
} else {
lcd.noDisplay();
digitalWrite(backLight,LOW);
}
// blink a dot
lcd.setCursor(15,1);
if(x % 2) {
lcd.print(".");
} else {
lcd.print(" ");
}
// wait a second
delay(1000);
}
}
zondag 24 maart 2013
Raspberry Pi, xmbc en een android tablet
Je hebt alleen een Raspberry Pi, xbmc, een app voor je android tablet of android phone en je muziekbestanden op een makkelijk te bereiken medium nodig.
Ingrediënten.
Raspberry piraspbmc
yatse of music pump xbmc remote
Een hoop mp3 bestanden op een USB stick, een usb-schijf, een smb of nfs server of een dlna of upnp device.
Een kleine "how to".
Je begint met raspbmc te downloaden en op een sd kaartje te zetten. Dit is op de site van raspbmc goed uitgelegd.Sluit de Raspberry Pi aan op een scherm en een klavier, steek de sd kaart in en sluit het netwerk aan, en sluit de stroom aan.
Als je de audio via de hoofdtelefoon plug aansluit kan je best even wachten tot de software geïnstalleerd is.
De Raspberry Pi gaat nu de laatste versie raspbmc software downloaden en installeren. Dit duurt wel even en de Raspberry Pi gaat een paar maal herstarten.
Android software.
ondertussen kan je op je telefoon of tablet yatse of music pump xbmc remote installeren.Media biblotheek.
Als de XBMC software op de Raspberry Pi staat, moet je nog wel zeggen waar je muziek staat.Hoe je dat doet staat goed uitgelegd op de site van xbmc
Alles op USB-stick of USB-schijf, steek de USB-Stick of schijf in de Raspberry Pi.
Als je een USB-schijf gebruikt, neem dan wel een type met een eigen voeding want de Raspberry Pi levert niet genoeg stroom.
dlna of upnp
dlna en upnp zijn protocols die het delen van media bestanden vergemakkelijken.Als je een eigen Linux server hebt kan je bv ushare installeren om je media bestanden via dlna of upnp te delen.
woensdag 5 september 2012
De halve marathon die niet doorgaat.
Damn. Ben je al een paar maand aan het trainen om in Eindhoven een halve marathon te lopen, beslist de politiek om op dezelfde dag ons allen op te roepen open onze burgerplicht te doen. Oké tot daar toe, maar ze me nu ook oproepen om op die mooie dag te komen controleren of jullie zo'n goede burgers zijn doet wel pijn. Daar gaat de motivatie :-/ . Ik zal me dan maar opladen voor de halve marathon van Kasterlee wat later op het jaar. Gelukkig is dat ook een vlak parcour :-).
vrijdag 18 mei 2012
Installation of Ubuntu 12.04 on a Dell Studio 1747
Just finished installing Ubuntu 12.04. A breeze to do. The whole process took less than an hour. Really fast.
Because I messed up the Ubuntu 11.10 (installed to much junk), I decided to start of with a clean sheet.
Because my documents are on a separate partition /home (actually it's even an different disk), it's easy to replace the OS and keep your data.
Because the hardware contains some specials, I had to enable some propriety software. The video hardware is from ATI, which has it's own driver you have to enable.
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
02:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI RV710/730 HDMI Audio [Radeon HD 4000 series]
The Broadcom wireless card driver was enabled by default.
The only thing I keep forgetting is the audio. The normal speakers work fine. But the headphones are something you have to enable.
Just add options snd-hda-intel model=dell-m6 to /etc/modprobe.d/alsa-base.conf and reboot.
The last thing to do was to install chromium, virtual box, calibre and 7zip, and that's it.
Thunderbird, Firefox, Chromium, Calibre, they all found there previous settings.
Ready to go.
First impressions?
Being used to unity, it looks the same. Tidy and fast. I like the bar with the applications by the side.maandag 23 april 2012
donderdag 24 november 2011
Printing in Ubuntu Linux on a Canon Pixma printer
woensdag 23 november 2011
upgrading from ubuntu 11.04 to 11.10
zaterdag 19 november 2011
replacing the HD in a netbook with a SSD
I've choosen an OCZ Vertex Plus drive with 60 GB of space.
Why replacing a perfectly good drive ? Well, for the speed of an ssd, the extra time you get out of the battery, and last but not least, to get some experience with SSD drive's.
The OCZ Vertex Plus is a SATA II drive, fast enough for the eee's sata port. 60 GB is more than enough for a computer mostly used for surfing and reading. The Vertex Plus seemed the right choice for an reasonable price (meaning, it's cheap).
Opening the asus and replacing the drive was rather easy, with many thanks to the posters on youtube.
Next step was installing an OS. I've choosen the ubuntu 11.04, the os that was on the netbook before the replacement of the disk.
Booting from an USB stick and installing was easy.
But then came the cold shower. After rebooting the netbook, nothing was found on the disk.
Trying the who installation process again, but alas, no success.
Surfing for solutions, I found out that the Vertex Plus had major issues with certain chip sets. The Intel 945 chip sets, as used in thee eee pc corrupted the boot sector (as seen here).
The first firmware upgrade (version 3.5) did nothing to solve the problem.
But the second firmware upgrade to version 3.55 solved the problem.
The netbook is now humming away with ubuntu 11.10. Booting the machine is fast, very fast. Overal response is fast as well. The old netbook now feels a lot snappier.
zaterdag 29 oktober 2011
39 years to double mankind
When I was born there were 3,245,121,422 people on earth.
My son is born exactly 39 years later, we where with 6,404,053,015
In those 39 years, mankind was nearly doubled, scary
link to the Guardian
woensdag 18 mei 2011
ubuntu 11.04 en audio op Dell 1747
Dit probleem had ik vorige keer ook (met ubuntu 10.04).
Gelukkig is de oplossing eenvoudig
volgend regeltje toevoegen aan /etc/modprobe.d/alsa-base.conf
options snd-hda-intel model=dell-m6en herstarten.
klaar
dinsdag 17 mei 2011
upgrade naar ubuntu 11.04 aka natty narwal
De netbook heeft de upgrade gekregen via softwarecentrum, dat ging vlot en zonder problemen.
De laptop is iets grondiger aangepakt.
Eerst een backup van de /home partitie en van de systeem partitie.
Dan opgestart met een cd van Ubuntu 11.04 AMD 64 bit versie.
De cd ontdekt zelf dat er al een ubuntu 10.04 geinstalleerd was, en geeft je de kans deze up te graden. Maar dat doen we dus niet.
De home partitie hergebruiken we zoals ze is maar de systeem (root of / ) partitie wordt geformateerd met ext4.
Na een half uurtje geduld en één herstart later ben je klaar.
Terug aanmelden en je vindt je gegevens netjes terug.
Alleen nog de programma's terug installeren die je echt nodig hebt.
Firefox vind je addons en bookmarks vlot terug. Email moet je ook niet opnieuw instellen. Firefox heeft wel het probleem dat er steeds om te herstarten wordt gevraagd.
Een terminal opstarten en "sudo apt-get --reinstall firefox" is voldoende om het probleem op te lossen.
Banshee inruilen voor Rythmbox is ook geen probleem, alleen weet ik niet of ik banshee boven rythmbox ga verkiezen.
Alleen nog de andere gebruikers opnieuw aanmaken, in de zelfde volgorde als vorig keer.
En voila, een nieuwe verse installatie zonder rommel van het verleden.
zaterdag 16 april 2011
Robotje poging 0.2
De ir sensor zijn ook dichter bij elkaar gezet, zo kijkt de robot iets meer voor zicht uit.
// left motor is on pin 3 and 4 of motorboard
int l_direction = 7; // select the pin for the E2 Left motor direction
int l_motor = 6; // select the pin for the M2 Left motor speed
int l_sensorPin = 1; // select the input pin for the sensor
int l_sensorValue = 0; // variable to store the value coming from the sensor
boolean l_directionValue = HIGH; // variable to store the direction
// right motor is on pin 1 and 2 of motorboard
int r_direction = 4; // select the pin for the E1 Right motor direction
int r_motor = 5; // select the pin for the M1 Right motor speed
int r_sensorPin = 0; // select the input pin for the sensor
int r_sensorValue = 0; // variable to store the value coming from the sensor
boolean r_directionValue = HIGH; // variable to store the direction
#define button 2 //frontbutton
boolean front;
unsigned long int timer_reversing;
unsigned long int timer_turning;
boolean reversing;
boolean turning;
char turndirection;
void setup() {
pinMode(l_direction, OUTPUT);
pinMode(r_direction, OUTPUT);
pinMode(button,INPUT);
reversing = false;
turning = false;
turndirection = 'n';
// Serial.begin(57600);
}
void loop() {
l_sensorValue = readsensor(l_sensorPin);
r_sensorValue = readsensor(r_sensorPin);
l_directionValue = setDirection(l_sensorValue);
r_directionValue = setDirection(r_sensorValue);
front = digitalRead(button);
if (front == HIGH) {
l_directionValue = LOW;
r_directionValue = LOW;
}
if(l_sensorValue < 20 && r_sensorValue < 20) {
start_reverse();
}
turn();
// serialprint(l_sensorValue,l_directionValue,r_sensorValue,r_directionValue);
controlMotor('l',l_sensorValue,l_directionValue);
controlMotor('r',r_sensorValue,r_directionValue);
}
void start_reverse(){
if (reversing == false) {
timer_reversing = millis() + 1000;
reversing = true;
}
}
void start_turn() {
if (turning == false) {
timer_turning = millis() + 500;
turning = true;
}
}
void reverse() {
if (timer_reversing < millis() ) {
if(reversing == true) {
start_turn();
if(l_sensorValue < r_sensorValue) {
//turn left
turndirection = 'l';
} else {
// turn right
turndirection = 'r';
}
}
reversing = false;
}
}
void turn() {
if (turning == true && reversing == false) {
switch (turndirection) {
case 'l':
//turn left
l_directionValue = LOW;
r_directionValue = HIGH;
break;
case 'r':
// turn right
l_directionValue = HIGH;
r_directionValue = LOW;
default:
l_directionValue = HIGH;
r_directionValue = HIGH;
}
}
if (timer_turning < millis() ) {
turning = false;
}
}
boolean setDirection(int value) {
if (value > 0) {
return HIGH;
} else {
return LOW;
}
}
int readsensor(int sensor) {
int value = map(analogRead(sensor), 0, 512, 255, 0);
return value;
}
void controlMotor(char side, int value, boolean directionValue){
reverse();
if (reversing == true){
directionValue = LOW;
}
switch(side){
case 'r':
analogWrite(l_motor,value);
digitalWrite(l_direction,directionValue);
break;
case 'l':
analogWrite(r_motor,value);
digitalWrite(r_direction,directionValue);
break;
}
}
void serialprint(int l_s, int l_d, int r_s, int r_d) {
Serial.print("l = ");
Serial.print(l_s);
Serial.print(" Dir = ");
Serial.print(l_d);
Serial.print(" r = ");
Serial.print(r_s);
Serial.print(" Dir = ");
Serial.print(r_d);
Serial.println("");
}
vrijdag 15 april 2011
De Antwerp 10 miles
Het weer ziet er goed uit, geen regen, 17 graden.
Ik hoop het rondje binnen de twee uur te lopen. Dat is geen top tijd, maar ik ben dan ook geen toploper. Als je pas op latere leeftijd begint te lopen, eigenlijk wat overgewicht meesleurt en geen competitie beest bent, dan is dat niet slecht. Al zeg ik het zelf.
Soit, we gaan dan ook meer voor de fun en het gezelschap en niet voor de competitie.
Tot lopens.
donderdag 14 april 2011
Robotje poging 0.1
1 robotplatform met 2 wielen en 2 motortjes (voorbeeld)
1 arduino uno (voorbeeld)
1 motorshield voor arduino uno (voorbeeld)
2 ir sensors (voorbeeld)
Het robotje in elkaar vijzen is eenvoudig. Om de motortjes aan te sluiten heb je wat soldeer nodig.
Het robotje is nog niet perfect. Objecten schuins vooraan worden opgemerkt en ontweken, maar wat recht voor de robot is worden niet gezien en dus niet ontweken.
de sketch:
int l_sensorPin = 0; // select the input pin for the sensor
int r_sensorPin = 1; // select the input pin for the sensor
int l_ledPin = 11; // select the pin for the LED
int r_ledPin = 10; // select the pin for the LED
int l_sensorValue = 0; // variable to store the value coming from the sensor
int r_sensorValue = 0; // variable to store the value coming from the sensor
int E1 = 4; // select the pin for the E1
int E2 = 7; // select the pin for the E2
int M1 = 5; // select the pin for the M1
int M2 = 6; // select the pin for the M2
void setup() {
pinMode(E1, OUTPUT);
pinMode(E2, OUTPUT);
}
void loop() {
// read the value from the sensor:
digitalWrite(E1,HIGH);
digitalWrite(E2,HIGH);
l_sensorValue = analogRead(l_sensorPin);
r_sensorValue = analogRead(r_sensorPin);
l_sensorValue = map(l_sensorValue,0,512,255,0);
r_sensorValue = map(r_sensorValue,0,512,255,0);
analogWrite(M1,l_sensorValue);
analogWrite(l_ledPin,l_sensorValue);
analogWrite(M2,r_sensorValue);
analogWrite(r_ledPin,r_sensorValue);
}
vrijdag 18 februari 2011
Snel een RAID1 maken op UBUNTU 10.10
1 computer met ubuntu
2 harde schijven (beide zonder gegevens die nog nodig zijn, dus niet de boot disk)
Deze twee schijven zijn het best identie, zeker wat betreft de performatie. De kleinste van de twee bepaalt de grootte van de uiteindelijke raid
stappen
installeer mdadmsudo apt-get install mdadmkijk of de schijven gevonden worden door de computer
sudo fdisk -lHier zou je 3 schijven moeten vinden, 1 met je al werkende partities, meestal /dev/sda[1-9]
en 2 anderen (meestal /dev/sdb en sdc)
maak op sdb en sdc een paritie die even groot is
sudo fdisk /dev/sdbsudo fdisk /dev/sdcformateren is niet nodige
maak de raid
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1controleer
sudo mdadm --detailled /dev/md0wacht tot de sync is afgelopen, je kan dit volgen met
sudo cat /proc/mdstatopgelet, hoe groter de raid, hoe langer het duurt (op mijn testsysteem nam een raid 1 met 2 disk en een grootte van 1 Tbyte ongeveer 6 uur in beslag.
maak je partities en formateer een volume
sudo fdisk /dev/md0mkfs -t ext4 /dev/md0that's it







