Saturday, February 27, 2021

Illusionist Locket, 3D print

 3D Printable illusionist Locket(From the movie The Illusionist)

This is my first attempt in 3D design. Wanted to design this for a very long time.



Support required for both "Left" Part and has to be curve surface down with support.

For the other two Flat surface to be on the bed and no support required.
No Gluing required. All the joints are snap to fit.
Use 1mm Dia X1.5 mm (Max 2mm DiaX2.5 mm) neodymium magnets. I have not fixed magnets as I am waiting to receive them. Make sure polarity of magnet is fixed correctly.

Print Settings

Printer brand:

Creality

Printer:

CR-10S

Rafts:

Yes

Supports:

Yes

Infill:

20

Filament brand:

Creality

Filament material:

PLA

Tuesday, January 7, 2020

How to make Ambilight TV using Orange Pi Zero with any HDMI Input.


I have seen lot of how to do Ambilight using Raspberry Pi and not one with Orange Pi. This is a long pending project for me. I had an Orange Pi Zero 512 MB that I bought for the same purpose. I had to do more time on research than making it. Making was only a days job. Finding the right component and debugging took a lot of time. The end result of the project is more satisfying and came well than I had expected.

Materials required

Item  Quantity  Price per item Price(AED)
Orange Pi Zero 1 134.15 134.15
Comon board PCB dotted  1 4 4
Splitter HDMI Full HD 1 65 65
HDMI to Composite  1 35 35
Video Audio VHS VCR USB Video Capture Card 1 40 40
HDMI Cable  3 20 60
AV Cable 1 10 10
Power cable 1 20 20
Power Extention  1 45 45
5 Port Powered USB 3.0 Hub Splitter
, 4 Port USB Data Hub + 1 Smart 2.4A Charging Ports USB Hub
1 70 70
SN74HCT00N  1 0.5 0.5
Heat Sink 1 15 15
Power supply 20A 5 V  1 46 46
APA102 5M IP30 60 LED per meter 1 141 141
Shipping and other charges  1 100 100
Total 785.65

Bought from:
Orange pi Zero -
https://ar.banggood.com/Orange-Pi-Zero-H2-Quad-Core-Open-source-512MB-Development-Board-p-1110210.html?rmmds=buy&cur_warehouse=CN

SN74HCT00N 
https://www.aliexpress.com/item/32964289834.html
Heat sink for Orange pi
https://www.aliexpress.com/item/32801098575.html
Power Supply 20A 5V
https://www.aliexpress.com/item/32879719595.html
APA102 LED strips
https://www.aliexpress.com/item/32878004298.html


Other items are bought from local stores
careful choosing the video grabber, first one I bought did not work. Even though I was able to open the video in mplayer v4l2 of hyperion could not detect.
sample of the grabber
https://www.amazon.ae/0-2-Meter-Portable-Easier-Cable/dp/B07MW82Z7Z/


The Making

1. OS download from Armbian website.
https://dl.armbian.com/orangepizero/Bionic_current
The version I used is
Armbian_19.11.3_Orangepizero_bionic_current_5.3.9
2. Burn using balenaEtcher
Download from https://www.balena.io/etcher/
3a. connet ttltousb use putty and set baudrate 115200
https://www.aliexpress.com/item/4000120687489.html

Power up the Orange pi zero after connecting.
Find out the COM port number from device manager in windows.

3. login as root with password 1234
Create new user by following the instructions given by the armbian
4. Type the following command to configure wifi
sudo nmtui 
5. After configuring wifi (choosing SSID and filling password) update the OS using the below command
sudo apt update & apt upgrade 
(reboot after this. you can use armbian-config to do this too)
6. Login as new user
 sudo apt-get install git cmake build-essential libqt4-dev libusb-1.0-0-dev python-dev libxrender-dev python
export HYPERION_DIR="hyperion"
git clone --recursive https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
 mkdir "$HYPERION_DIR/build"
 cd "$HYPERION_DIR/build"
cmake -DENABLE_DISPMANX=OFF -DENABLE_OPENCV=OFF -DENABLE_SPIDEV=ON -DENABLE_X11=OFF -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
make -j $(nproc)
strip bin/*
sudo cp ./bin/hyperion-remote /usr/bin/
sudo cp ./bin/hyperiond /usr/bin/
 sudo cp ./bin/hyperion-v4l2 /usr/bin/
sudo mkdir -p /usr/share/hyperion/effects && sudo cp -R ../effects/ /usr/share/hyperion/
sudo mkdir -p /etc/hyperion
#copy hyperion.config.json to /etc/hyperion (SPI is 1.0 and color is bgr no-change as video standard) This file is attached in the link below
https://drive.google.com/open?id=1vGN3vltVbZdioBn_0Ww6Or3sBkS1JCYx

sudo mkdir -p /etc/init/ && sudo cp ../bin/service/hyperion.initctl.sh  /etc/init/hyperion.conf
sudo cp ../bin/service/hyperion.init.sh  /etc/init.d/hyperion
sudo cp ../bin/service/hyperion.systemd.sh  /etc/systemd/system/hyperion.service
sudo apt-get install v4l-utils
sudo systemctl enable hyperion
sudo systemctl start hyperion
Now add the user created to sudoers list and make it not to ask for password
sudo visudo -f /etc/sudoers.d/90-kiran
Add below line in the file. here kirant400 is the user name I have choose. Replace it with the one that you provided in step 3.
   
kirant400 ALL=(ALL) NOPASSWD:ALL
Finally edit /boot/armbianEnv.txt file to enable gpio and spi adding the below line
you can use command
sudo nano /boot/armbianEnv.txt
overlays=usbhost2 usbhost3 w1-gpio uart1 i2c0 spi-spidev
param_w1_pin=PA20
param_w1_pin_int_pullup=1
param_uart1_rtscts=1
param_spidev_spi_bus=1

Careful while editing this file if we make a wrong entry system do not boot and we have to redoo all the steps again

Final File content may look like:

verbosity=1
console=both
overlay_prefix=sun50i-h5
overlays=usbhost2 usbhost3 w1-gpio uart1 i2c0 spi-spidev
rootdev=UUID=abc1d3dd-6193-4fb7-93fb-f50382b8a8b9
rootfstype=ext4
param_w1_pin=PA20
param_w1_pin_int_pullup=1
param_uart1_rtscts=1
param_spidev_spi_bus=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

Assembling 

Connection Diagram is given below
Connection of Orange pi Zero and APA 102 LED strips
I had double sided LED strips which was pasted on the edges of the TV Screen. Make sure the TOP and Bottom has same number of LED, similarly right and left has the same number.
Note these numbers. This is used for configuring the LEDs in Hyperion Config(https://hyperion-project.org/wiki/HyperCon-Information).


Connect both ends of +5 and GND together and to the 5V 20A power supply. Current rating depends on the number of LEDs on the screen.

Configuration

HyperCon is the software used for configuring.
Only configurations made are:
LED type selected APA102, color order is changed and SPIdev1.0 given below
                "type"       : "apa102",
"output"     : "/dev/spidev1.0",
                "colorOrder" : "bgr"
Other change was Enabled  grabber-v4l2 and standard manually edited value as "no-change" as given below
                "standard" : "no-change",

Other important change I did was to change the configuration of my grabber using v4l2-ctl command
First Install v4l2-ctl
sudo apt-get install v4l-utils
And now change the grabber setting
v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=1 

This I have added in the service script prior to hyperion service start. 

Working

After powering up all the mentioned connections our Ambilight is ready.

We can also download hyperion free mobile app and control the lights. This App is available for iOS and Android.

Troubleshooting 

I have first tested light alone using Arduino code before and after attaching to TV. 

For the grabber to check 
1) mplayer install and make sure it is being able to show the video input
2) use hyperion-v4l2 for taking screenshot and see if hyperion is able to get the grabber input. Below command is used for taking a screenshot 
sudo hyperion-v4l2 --width 320 --height 180 --screenshot

Also change the configuration to write to a file and inspect the file for RGB values if hyperion is able to detect.
I also change the BLACKBORDER detection  threshold to 0.2 for better detection.

Friday, January 29, 2016

Pic Microcontroller Baud Rate register value calculator online


It is a must to set SPBRG value, when interfacing with UART/USART device with PIC micro controllers. 
The formula to calculate SPBRG is given below
Error can be calculated by

Where Fosc is the frequency of the crystal used in PIC micro eg: 20MHz. And Baud Rate is the desired  required baud rate.
The tool below can be used to calculate the SPBRG and Error %.

Crystal frequency :

Desired  Baud rate :

Is Synchronous


Result: Use calculate button

Sunday, May 24, 2015

Magic Wand

Started working on the Magic Wand project.
POV. Persistence of vision is used here to create this magic wand.
Letters are created using the controlled switch on and off LEDs.

Please look at the video below.
I have implemented this using the guide provided

Sunday, May 3, 2015

RFduino Installation in Ubuntu

RFduino now support Linux and installation is straight forward.
Step1: Open terminal in ubuntu by pressing Alt+Ctrl+T
Step2: Type the following commands
cd ~
mkdir Arduino
cd Arduino
wget http://downloads.arduino.cc/arduino-1.6.3-linux64.tar.xz
tar -xf arduino-1.6.3-linux64.tar.xz
sudo apt-get install default-jre

key in password when prompted.
No driver installation required for Ubuntu. 

Step3: Open Arduino by typing the following command
cd arduino-1.6.3
./arduino

The current version is 1.6.3. It will be different for different versions.

Step4: Select Menu File->Preference
 in the proxy settings change server to rfduino.com and keep other settings as it is and click OK.
in "Additional Board Manager URLs, add "http://rfduino.com/package_rfduino166_index.json" and click OK

Step5: Select Menu Tools->Board->Board Manager and in the window that is opened select RFduino and select install.
 It will take a while to download and install files there are 2 set of files one ~ 36MB and other ~52MB

Step6: Select Menu Tools->Board->RFduino

Step7: Select Menu Port->/dev/ttyUSB0
 USB menu item will be different in different machine.

Thats it.
Some examples can be found in Menu File->Examples section for RFduino.

Happy Programming.

Saturday, May 2, 2015

Coffee cup using blender

Blender is an amazing 3D modeling tool.
Just started using it ofer 3Ds Max. I find it amazing.
I followed the below tutorial
And created the "hello world" 3D model.
It came out to be like this.

Friday, January 16, 2015

Why Windows 8.1 is a failed operating system to me

I am using windows 8.1 currently.
The following features make me not a big fan of this OS.
1) The wifi problem. 
     The wifi reluctant to connect at times when you most need. Need to disconnect and connect many times to get it working. From windows forums got to know that it is the driver issue and they do not have any intention to fix it. The same machine I dual boot for ubuntu which works perfectly. 
I have followed some tutorials how to make this work but no success. The Machine I use is Dell inspiron N5050.
2) The Update.
   When you just want an urgent mail to send, open the computer then I see this blue screen preparing to configure system do not turn off message. and since my internet do not work It keep on showing 30% for some time then get through after a waiting period. I never know that it has been successful or not. 
3) Full screen apps do not work.
 I had run in to situation that the full screen apps do not work.I just wanted skype but it was not happening and since there was a problem with internet struggle to update and after updation it started working.
4) Login issue.
The internet is never get success at the time of booting unless i continuously switch the wifi on and off. Hence Authenticating time is more and some times it do not recognise and sign me as guest. 
5) Privacy issue.
I had put profile pic of the system by taking a photo suing webcam and shocked to see it was changed my online live account too. 
Skype now use the system password. Once changed skype password using the instruction provided and shocked that my machine password was the one i had changed.
The usability and intuitiveness for the OS is minimum. Ubuntu on the other hand it is the prefered OS.
But stuck with windows because some application dependent. 
"Windows a Bad OS with good applications, ubuntu Great OS with limited/buggy applications"


Contributors