I'm learning python (again) to use it on my Pycom micropython WIPY2 and LOPY modules. It is a fun language to learn.
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
andrethemac's blog
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
donderdag 15 december 2016
nextcloud 10, centos 7 and rh-php56
nextcloud is a great alternative for dropbox.
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/
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.d
sudo mv 10-php54-php.conf 10-php54-php.oldcd /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.
Labels:
arduino,
clock,
neopixel,
rtc,
weekend project
Abonneren op:
Posts (Atom)