Spin Indexer Plate Calculator (python)

I did up this program to calculate out the amount of divisions that a spin indexer could do, and calculate out the degrees that each needs. I designed it because If you have custom plates, you’ll get different values for everything, and this program will calculate everything out for you, with the degrees needed to achieve each division. Just change num to whatever you want to get the divisions and list of degrees to get those numbers.

num = 360

for i in range(1, num + 1):
    if num % i == 0:
        print'\n', i, '\n'
        t=num/i
        j=0
        while True:
          j=t+j
          print(j)
          if j==num:
             break
			

If you dont want to mess with it, and only want the 360 degrees printout, I have it here:

https://drive.google.com/file/d/0BwYG1PFb3ZBydFZrUWpMTVZJNUk/view?usp=sharing

I had mine start at 0 and removed the 360 to make it easier for my indexer.

Advertisements

Making Pepakura work on linux/wine

After needing pepakura designer to unfold some 3d models I had so I could make them for a project and finding out that it wouldnt run on linux/wine for anything, I started tinkering around and discovered that by default, wine doesnt have opengl32.dll registered inside of wine dll registry.

If you go into the settings for wine, the wine configuration tool, then in the dropdown box, type in “opengl32.dll” without quotation marks, then click ok, pepakura designer and all software needing opengl graphics will work flawlessly without any errors or anything.

I figured I would post this since this seems to be an almost unsolvable problem between linux/wine users and pepakura software users.

Edit: After discussing this with a few people, Ive discovered that the issue hasnt gone away with a clean install, here is another opengl32.dll file to add to the one in wine’s windows/system32 folder, just add that in, add opengl32.dll to the libraries under wine’s configuration program, and set your windows version to windows vista in wine’s configuration while your already there.

It should work fine after that.

https://drive.google.com/file/d/0BwYG1PFb3ZByMjRuZlpFN05fU0E

Updating firmware on USBASP from eBay

I got a USBASP off of ebay over christmas, but when trying to use it, avrdude and arduino would complain about the sclock not being able to be set. After a while of looking it up online, I found out that the issue was with an old firmware, so after a little research, this is what I discovered and what I had to do to update it.

This guide is for linux, if you want a guide for windows, here’s one that is the equivalent of it:
http://www.rogerclark.net/?p=702

First, install the megaisp sketch on an arduino, then hook the arduino to usbasp by connecting the arduino’s pins, to the 10 pin header on the usbasp programmer, using this diagram to hook it up:

My connections were
 Arduino    USBASP
 5V ———– 2
 GND ——– 10
 13 ———— 7
 12 ———- 9 (MISO)
 11 ———- 1 (MOSI)
 10 ———  5 (RESET) 

Just make sure to have it unplugged from the usb port while doing all of this. Also, you’ll need to short the program pin, on mine, it was pin 2 but you may need to check yours to see what yours is. I used a piece of wire on mine shortly to short them together, just by putting the wire through the holes and wrapping the wire around the whole USBASP programmer.

Then try to use this command in the command prompt, if everything goes correctly, it’ll say something like “AVR: ready to accept commands” or something like that:

avrdude -c avrisp -P /dev/ttyACM0 -b 19200 -p m8 -v

If it complains about “AVR: not found” or something like that, then check your wiring, or check your programmer’s chip to make sure it has the ATMEGA8, and if not, change the “m8” to whatever chip is used.

If everything works fine and it is ready to accept the commands, you can download the updated firmware from the site. Here’s the link: http://www.fischl.de/usbasp/

Just download, extract, and use this command to update the firmware:

avrdude -c avrisp -P /dev/ttyACM0 -b 19200 -p m8 -U flash:w:usbasp.atmega8.2011-05-28.hex

If everything went according to plan, you should be able to just unplug the USBASP from the arduno and plug it into the computer , all ready to go.

Here is the one that I purchased and that the pinout worked on:

usbasp programmer

Also, if you have one of these, and you notice that it doesnt work sometimes, just unplug it and wait a few mins, then try again, mine tends to misbehave if you unplug it and plug it in a few times, I think mine just spazzes out sometimes.

Setting up the Raspberry Pi to be a PS3 streaming server (DLNA server)

A while back, I kinda wished that I could stream the stuff from my raspberry pi server, which had torrent server, octoprint (3d printer server), NAS server, server for standard printers(cups), and many other servers, to my playstation 3, but no matter what I tried, I couldnt get anything to work. I finally discovered that what most systems use to detect media servers like ps3 media server programs is called a DLNA protocol, then after a little research, I discovered that the raspberry pi has a version of DLNA that can run on it easily called minidlna.

just do:

 sudo apt-get update
 sudo apt-get upgrade
 sudo apt-get install minidlna

Then edit the configuration file by typing this into the terminal:

 sudo nano /etc/minidlna.conf

you’ll see something like this:

media_dir=/home/pi/videos

at least starting with “media_dir”, just change the stuff after the = sign to where your files are that you want to stream.

You can also uncomment the line

 friendly_name=raspberrypi

to anything you want, and that is the name that will show up on the ps3/bluray players/media centers.

To get it to start up on boot, just run this command at the terminal:

sudo update-rc.d minidlna defaults

and reboot the raspberry pi. If you make any changes to the /etc/minidlna.conf file later on, you’ll have to have it update the library files manually. You do that by typing in this command into the terminal:

sudo service minidlna force-reload

After that, just start up your ps3, and within seconds, you should see a new icon under music, pictures, and movies that has the debian like logo. That will be the raspberry pi with all of your video files/music/pictures.

Ive also found that alot of bluray players and such that are hooked into the network, they’ll also have that same icon appear on them also with the same layout and everything as the ps3, and will be able to stream the media to them, assuming that the bluray players will actually support the said media in the first place.

My FreeCAD addon

Ive been working on a FreeCAD addon since I use kisslicer to slice up my stl files for my 3d objects I design, so eventually, I got tired of constantly having to search for the stl files, and designed this code. The code will automatically convert only the visible parts that you want, group them together, and export it as an stl file next to the original design file, with the same filename except with stl extension. Then it’ll open the STL file automatically for you ready to slice and to create gcode from your settings.

I designed it on linux, but it should easily be converted to be used on windows or any other system. Just create a macro in freecad, and paste this into the macro, then save it. Then you can go to tools/customize and set up the macro to a button on the toolbar, so you can just click the button and it converts everything for you.

import FreeCAD
import Mesh
import sys
import math
import os
import subprocess

# some fuctions

def getPlacement(quat,vect,obj):
  if quat[3] > -1  and quat[3] < 1:
    delta = math.acos(quat[3])*2.0
    scale = math.sin(delta/2)
    rx = quat[0]/scale
    ry = quat[1]/scale
    rz = quat[2]/scale
  else:
    delta = 0
    rx = 0
    ry = 0
    rz = 1

info0 = "translation "+str(vect.x)+" "+str(vect.y)+" "+str(vect.z)
info1 = "rotation "+str(rx)+" "+str(ry)+" "+str(rz)+" "+str(delta)
return info0+" "+info1
# some definitions
placement = App.Placement(App.Vector(0,0,0),App.Rotation(0,0,0,1))

# user need to set this directory where STL files will be placed
OutDir = FreeCAD.ActiveDocument.FileName.replace(FreeCAD.ActiveDocument.Label + ".fcstd", "")
visible_objs = []
KISSlicer = "/kisslicer location/"     #put the location of your kisslicer directory here
os.chdir(KISSlicer)

# Get Objects in document
doc = App.ActiveDocument
objs = doc.Objects

# hide all
for obj in objs:
  if obj.ViewObject.isVisible():
    visible_objs.append(obj)

print "number of volumes "+str(len(visible_objs))

for obj in visible_objs:
# {
  # get volume
  volume = obj.Shape.Volume

  # get Rotation and translation of volume
  quat = obj.Placement.Rotation.Q
  vect = obj.Placement.Base
  pinfo = getPlacement(quat,vect,obj)

  # reset placement, export it and set at original placement
  oldPlacement = obj.Placement
  obj.Placement = placement
  obj.Placement = oldPlacement

stlFile = OutDir+str(doc.Label)+".stl"
Mesh.export(visible_objs,stlFile)
subprocess.Popen([KISSlicer + "KISSlicer", stlFile])

You’ll have to change the values of the location of KISSlicer, or modify it for whatever slicer software you use, and it should work fine.

Premade Netbook Kernel Image

Well, Ive been talking about designing my own linux kernel for the sylvania netbook, or cheap chinese netbooks for a while now, and I figured I’d share my modified kernel which contains usb sound card support, most usb wifi dongles that the raspberry pi can use, along with most of the extra hardware that the raspberry pi can use too. I also changed the linux kernel image from the penguin tux logo to the raspberry pi logo since technically we are hacking the netbook into thinking that it’s a lightweight version of a raspberry pi.

Well, Here’s what youve been waiting for, the download link:

https://drive.google.com/open?id=0BwYG1PFb3ZByeEN5ZW9vS3dNdlU&authuser=0

Just download it and inside of the archive will be a folder named script that contains two files, just copy that script folder and two files over to the base of the boot partition of the SD card that the rpi soft float disk uses.

This is designed for those who dont want to deal with the headache of designing thier own kernel.

Only two things that I have yet to fix is no onboard sound/battery info since they both use the vt1613 chip, and the rebooting, but just shut it down and turn it back on. Its not as much of a headache as it sounds.

Here’s the files to create everything by yourself or modify the files if you wanted.

https://drive.google.com/open?id=0BwYG1PFb3ZBydmNWRktzM01PQkE&authuser=0

My little Printrbot Jr assembly kit

Here, Ive collected all of the documents and everything needed to assemble and get your printrbot jr up and running, and comments to really help get those first getting started to get decent prints.

Printrbot Jr. Instructions:

http://printrbot.dozuki.com/Guide/Printrbot+Jr.+Kit+Build/25/1

Printrbot Jr Extruder Instructions (is not included with normal instructions):

http://printrbot.dozuki.com/Guide/Extruder/38/1

I had to take a knife and file down a little bit on the wood in where the hot end goes in so it would fit, and it slides up inside the bottom of the wood extruder parts, then there’s two long screws that go through the wood and into the beveled part of the hot head to keep everything locked into place. It’s kinda hard to see that, so I figured I’d mention how it went.

While assembling everything, you’ll want to check all connections multiple times, and defenitely check the fan so it’s not shorted, short circuits will blow up parts on the circuit board, and is very expensive to fix.

Also, for those saying it only takes around 2 hours to assemble the printer itself either is on some serious speed, or has found a way to control time because it definitely doesn’t go that easily. I can usually just blow through assembly of something in a few hours of what takes most people a week, and this printer took me close to 2 full days to put together.

For those who have the problem of the printer wanting to home to the bottom right instead of bottom left, the X axis wire can be rewired easily using this diagram to fix all of those problems:

http://d17kynu4zpq5hy.cloudfront.net/igi/printrbot/jHFB2IXlYOxwWhJs

The easiest software Ive found to use is repetier host, it can be downloaded here:

http://www.repetier.com/download/

or if you prefer to use a laptop and dont feel like needing to have it plugged in all the time to the printer while printing, you can set up a raspberry pi as a print server like I did using octoprint using this method:

https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian

Then just run repetier-host on your laptop to just slice the files into gcode, and save it, then use the web-ui of octoprint to upload it to the raspberry pi. After you get everything set up, I would highly reccommend putting at least 3 layers of the wide blue painter’s tape on the print bed, dont overlap the pieces for each layer, just make it so it’s perfectly flat. For repetier host, there is a setup guide here:

http://printrbot.com/wp-content/uploads/2013/06/Getting-Started-Guide.pdf

but it doesnt show what print size to put in, so here’s the dimensions I used for the printrbot jr and they work perfectly:

X = 140

Y = 114

Z = 102

For temperatures of printing of normal layers and base layer in slic3r settings, I reccommend first layer being 195C and rest of the layers being 190C. Those have given me the best results with the natural PLA cord that you recieve with the printrbot.

After you get all of that set up, make sure the bed is perfectly level with the nozzle, you can do this by just moving the nozzle to the corners and turning the bed levelling screws until the nozzle looks like it’s just touching, but you can just barely slide a piece of paper between the bed and nozzle. After that’s all done, you should be able to plug in the USB cable to the computer or raspberry pi, then plug in the power for the printer. You should hear the sound that it makes when the usb is connected in windows, or in linux, by using the terminal, type lsusb into the terminal and you should see something with 4 capitilised letters, like YUSD or something like that, I forget what it shows atm, but it is something like that. If it doesnt make the sound in windows or show up in lsusb in linux, just unplug the power cord from the printer, and plug it back in. If it still doesnt work, check all of your wiring and check everything in the printer again. The best idea is to wait to put the printrboard circuit board and wiring in the base of the printer until you know everything is working fine.

Another thing to mention is, just let the printer heat up for a few minutes, like 3-5 minutes before starting your prints, and keep the print head off of the board while it’s heating up so it doesnt burn the tape. (it is around twice the temperature needed to boil water) Also, if you start running into one side of the bed, where the edges of the raft or bottom layer of the prints start lifting up and curling the passes, then letting it preheat usually fixes that, and if not, just loosen the bed leveling screws a little bit and it should fix that. It’s usually caused by either the bed not being close enough or the extruder not being warmed up enough.

I think I covered everything I could remember atm, but if I remember anything else, Ill be sure to add it. I hope this helps whoever reads this and is first getting started with the printrbot jr kits.

Designing your own Linux Kernel for the sylvania netbook

For a while now, Ive been absent, trying to create my own custom linux kernel for the sylvania netbook, and this is where Ive gotten to, and included all info on how to build your own kernel image.

First, you need to install a toolchain, I used emdebian toolchain, which on a normal ubuntu/debian linux system, just use

 sudo nano /etc/apt/sources.list 

and add this to the bottom:

 deb http://www.emdebian.org/debian squeeze main 

Then do your standard “sudo apt-get update”.

You then need to install the toolchain by using:

sudo apt-get install g++-4.4-arm-linux-gnueabi

Now that the toolchain is installed, you’ll need to get the kernel sources for the netbook, you can get them here:

http://gitorious.org/linux-on-via-vt8500/vt8500-kernel/archive-tarball/v2.6.35-vt8500

Just extract that archive and go into it through terminal, the next part you’ll want to do as root, so use “su” command to switch to root.

next, you’ll have to paste this into terminal window:

export CROSS_COMPILE=arm-linux-gnueabi-

then do

make menuconfig arch=ARM

make sure you paste that in, or make sure caps match on the ARM switch otherwise it wont work. Then you can configure everything down to the drivers that are included, and set everything up as needed. Just watch out for power management stuff under drivers because it seems to make the kernel panic on boot, and just crashes it until you remake the kernel without those drivers. Also, if you use arduino microcontrollers, make sure the CDC AMA modem drivers are enabled or your arduino wont be even recognized.

When you have it all set up how you think it goes, just select exit and it’ll ask you if you want to save the config file, just say yes and it’ll take you back to the command prompt. Then all you need to do is type in:

 make uImage arch=ARM

After a few mins, if everything succeeded, you’ll have a uImage file in the linux-for-vt8500/arch/arm/boot folder. Just use the script folder and scriptcmd from the archive located here:

http://code.google.com/p/yus-repo/downloads/detail?name=wm8505-kernel-3.0-fatpart.tar.gz

Then just stick it in the netbook, and if everything works well, it’ll boot right up to the desktop, and if not, just play with the options till you get the stuff working right.

You could probably use the same method to create your own kernel for the raspberry pi, but just omit the uImage switch in “make uImage arch=ARM” part.

 

EDIT: the script folder goes in the small FAT partition, the 50MB or however big partition it is, but the SD card will be split into two partitions, one big and one small, just put the script folder with those two files in that partition to get it to work.

Happy hacking and good luck 😛

Make LXDE look like gnome 2

Here is a little guide to making lxde look like gnome 2 because I for one cannot stand the look of the tiles everything operating systems, or the windows start menu look alike desktop, so I found a few mods for lxde to bring it as close to the good old gnome2 interface as we could get it.

First, right click on the panel at the bottom of the screen where everything is at and click “Panel Settings”. You’ll want to change the Edge option to Top so it puts it on the top of the screen, then you want to click the Appearance tab and select the option for system theme, and uncheck the “custom color checkbox”.

Then you’ll want to go to the Panel Applets tab and set the applets up like this:

spacer, Menu, Application Launch Bar, 3 Spacer Applets(click the checkbox in one so it fills the rest of the space up), Manage Networks, System Tray(Dont delete this!), Volume Control, and finally Digital clock.

then click on the edit button on the digital clock options, and in the Clock Format button, change the “%R” to “%r”, just changing the capital R to lowercase, this changes the clock from 24 hour time to 12 hour (AM/PM time),  then click ok on everything.

Then you’ll want the bottom bar, so right click on the bar at the top and click “Create New Panel”. Right click on the bottom bar and add the applets like this in this order.

Spacer(edit it to go 10 pixels), Minimise All Windows, Spacer(edit it to 10 pixels again), Task bar(Windows List) (click the checkbox on that one so it fills up the dock, and I added the Temperature Monitor as the last one to keep an eye on my temps at the bottom right of the screen out of the way.

Then finally, under preferences in the main menu, select “customize look and feel” and just select “Clearlooks”. Then go to mouse cursor and select the “Adwaita” set so the mouse didnt look like a broken hand when your clicking on things. 😛 I went to fonts and disabled anti-aliasing to give a little more speed, but that’s just something I did.

I decided to make lxde look like gnome2 rather than just setting up mate because of the speed and memory usage differences, lxde does run a good bit faster, but I liked the look of gnome2 interface.

I hope this helps some people out in some way.

Sylvania Netbook Debian Linux

We found this Sylvania netbook in someone’s trash about a week ago and when I got it, it didnt work and wouldnt even try to charge. Upon further inspection, all that was wrong with it was just power connector that broke away  from the solder joint inside of the netbook. It originally ran Windows CE 6 and has a WM8505 SoC processor inside. As you can tell Im not a windows person at all, and started looking around for a good linux system that would run on it. I found a ton of android versions for it, but I was wanting true debian version that I could run directly from the SD card, just like the Raspberry Pi. Then I could leave android installed on the internal flash so others could use the thing also for their ebook readers and such.

Ok, I dont really have my own distro like everyone else, but I discovered a way to put a full debian distro on it using these steps:

First, you’ll need to download the two parts you’ll need for getting the system to boot on the netbook and OS from the raspberry pi. You’ll need the Linux kernel files for the netbook:

http://code.google.com/p/yus-repo/downloads/detail?name=wm8505-kernel-3.0-fatpart.tar.gz

And the main OS from the raspberry pi. You’ll want the softfloat version because the hardfloat wont work on the older arm6 chips.

Torrent 2013-05-29-wheezy-armel.zip.torrent
Direct download 2013-05-29-wheezy-armel.zip
SHA-1 d42d913fb4f49b351ef865edcf318f47ae04edca
Default login Username: pi Password: raspberry

There’s the torrent and primary download from the raspberry pi site itself. Just follow the instructions here to copy the OS to an SD card, just as you would any raspberry pi system.

http://elinux.org/RPi_Easy_SD_Card_Setup

Then unplug the SD card and plug it back in so the two partitions show up on the SD card. You’ll see that the larger partition doesnt take up the full space on the sd card, that’s fine, it’ll be fixed on the first boot. The smaller partition that has the boot files, just extract the fatpart.tar.gz folders into that partition so it shows up with the tools and script folder on the base disk part.

From there, just unmount the SD card partitions and insert the SD card into the netbook, and it’ll boot up right off of the SD card if everything is set up correctly. Then it will boot to a blue screen with options to change locale, password, keyboard layout, and expand SD card space. You’ll want to select the expand option so it uses all of the empty space on the SD card. Just set up all of your options and select finish, and let the netbook reboot like it asks.

This version doesnt have any sound support yet, but everything else works fine, Im currently working on finding a kernel module that would work, but having a bit of difficulty atm due to unable to find much about the sound card.

It will boot right up to the desktop and everything should work fine.

If you get the issue of when you try to shut down or reboot from lxde menu, it may ask for password, and the dialog will dissappear before you can enter anything. An easy fix for that problem is right here:

http://forums.linuxmint.com/viewtopic.php?f=141&t=60561

But instead of:

gksu gedit /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy

you want:

sudo leafpad /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy

or

sudo nano /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy

From then on, the system will run all programs that are available to the raspberry pi, which is an insanely large list. Everything should be able to be updated and such with no issues at all and install everything just fine.

After this is all done up and set up how you want it, you should be able to interchange the SD card between the netbook and the raspberry pi with no effort.

Just a warning, if you fully update everything, and due to the low amount of RAM in the netbook, it’ll slow down the netbook really badly, so best thing that Ive found is just to do “sudo apt-get update” and install/uninstall all of the stuff you want/dont want and leave it be.

EDIT: After discovering that the softfloat version is being discontinued, I searched for a mirror site for those who need the images still, which is here:

http://www.mirrorservice.org/sites/downloads.raspberrypi.org/images/debian/7/2013-05-29-wheezy-armel/

And updated the download links in the guide. If the links die again, just google for “2013-05-29-wheezy-armel.zip.torrent” and it’ll show a bunch of mirrors with the files needed for this guide.