3d printed propeller and arduino

recently I bloged about controlling motor with custom made power supply http://nikola.link/?p=50

transistor used there was bipolar junction transistor which can not conduct enough current needed to power a larger motor so in order to power bigger motors what one needs is a mosfet transistor.

mosfet is controlled by voltage and can have more current flowing trough while bjt are controlled by current and can conduct small amount of current
so this is the tutorial that shows how to use mosfet with arduino

http://bildr.org/2012/03/rfp30n06le-arduino/

and here is it in action

Bigger motor with propeller

A video posted by @mn080202 on


I used this propeller mentioned in one of my previous posts
http://www.thingiverse.com/thing:30284

3d printed screw(from openScad examples)

picture

3d screw

A photo posted by @mn080202 on


here is video of it in action

3d screw

A video posted by @mn080202 on

and here is the open scad file
https://gist.github.com/uControllerBot/60acb2da8e1824a6c6f4
thingiverse
http://www.thingiverse.com/thing:459792
it is also in gitstash repo called
uControllerBot3dPrinting

 

Arduino power supply with 3d printed circuit board

from tutorial
http://www.ladyada.net/library/equipt/diypsupp.html
http://www.wikihow.com/Wire-a-Potentiometer

in action

Arduino power supply

A photo posted by @mn080202 on

Arduino powe supply

A photo posted by @mn080202 on

schematicsschemeit-project

 

open scad code of this circuit board
https://gist.github.com/NikolaMandic/25627e29b6e33e2b33ba
you need to drill holes manually for potentiometert
video of it operational

board from one of the previous posts can be used instead of those colorful wires since it worked but I removed it while debuging

Power supply in action

A video posted by @mn080202 on


link to motor control board http://nikola.link/?p=26

 

tsung tricks

when testing with tsung sometimes it can get annoying if you want to quickly rerun test over and over again. So here are simple commands to make it easier

imagine a simple workflow with tsung tester where you

modify test with different parameters
rerun the test
change into new directory
regenerate results
display it

but what if you want to do that very frequently it gets annoying/slow because you have to c/p the directory where the logs are.

so here is one command to serve the latest results from log directory what it does is:

get folder that is created last in log directory
run python server there

cd /home/ubuntu/.tsung/log/`ls -tAF /home/ubuntu/.tsung/log| grep ‘/$’ | head -1`;python -m SimpleHTTPServer
here is the secondone
regenerate latest each 10 sec for tsung

watch -n 10 means every 10 sec run the following command
then get the latest log directory
run the script for log generation

watch -n 10 “cd /home/ubuntu/.tsung/log/`ls -tAF /home/ubuntu/.tsung/log| grep ‘/$’ | head -1`; /usr/lib/tsung/bin/tsung_stats.pl;”
what is nice thing about the tsung is that you can generate results while test is running so if you have 3 terminals open you just run test in one run second command in second one and third command in third one and just click the refresh button on your browser 🙂
makes for better experience when changing tests often.

exRTB status update

intro:

realtime bidding(RTB) is a process that takes place before ad is displayed on a mobile phone.
ExRTB is the software that plugs into one of RTB exchanges(for example smaato) where it does bidding

overview:
exRTB is realtime biding software designed to be easily scalable.
it consists of several components written in elixir for nodeDiscovery, persistance of transactions, and for doing the actual bidding also it uses graphite and docker

main component exRTB is the one that is doing actual bidding
persistance component does centralized accounting
and nodeDiscovery is a simple key value store for discovering distributed component

As of several days ago from writing this post it passes both of smaato compliance tests. That marks a milestone in its development.

Redirecting Console Output

In various languages one can redirect standard output.
In JavaScript console.log is often used as stdout analogue.
It might be useful to redirect it.
One can just mock console object and provide custom log methods.
But then it is hard to emulate the sprintf like functionality of console.log.
There is library on the web called sprintf https://github.com/alexei/sprintf.js
that can step in and provide something like console.log emulator.

Here is one example in CoffeeScript
first install sprintf from github and require it like any other module

sprintf = require('../sprintf/src/sprintf').sprintf

this line might be needed if engine optimzes variables so that it is not lost.
it outputs nothing

sprintf('a')
  1. create IIFE and closure with console object.
  2. pass an object with mock log function
    2.1 mocked function copies arguments
    2.2 and calls sprintf with the arguments passed to mocked log functions

so inside the closure console.log is redirected to sprintf

((console)->
console.log "output: %s","a"
)( log:()->
arg=Array.prototype.slice.apply(arguments)
console.log (sprintf.apply(this,arg))
)

Small Demo of Diskotek in Development

The following video shows current capability of diskotek
in driving the backend utilities and the gdb in browser.
It shows:

  • loading of file in gdb without running it.
  • viewing information from disassembled file.
  • recording, sending commands.
  • stepping over, setting breakpoints and running.
  • creating new script and running it step by step until it gets to
  • where the user stopped when using gdb manually.
  • it also shows new beeScript features like double dot field accessor
  • and interpolation when sending commands to gdb.
  • and at the end the “render” function witch triggers ui refresh with current data from the backend.

It is not smooth as it could be right now but this is just a demo of functionality developed
so far.
Some functionality will be changed like for example accessing entry point from beeScript.
It does not show memory editing.

CoffeeScript Function Invocation

I could not find this in documentation so here is a blog post.
Lets say you want to pass an object to a function in CoffeeScript.
Like so:

options =
option1: true
option5: false
methodCall(options)

You can also do it like this:

methodCall({option1:true,option5:false})

or you can do it with out the {}

methodCall(option1:true,option5:false)

or you can use multiple line

methodCall(
option1:true,
option5:false
)

but what happens if you want to pass two seperate objects like this:

methodCall(object1,object2)

you can write

methodCall({option1:true},{option5:false})

but you can also use indenation for same effect

methodCall(
option1:true
option5:false
)

this is an error

methodCall(
option1:true
option5:false
)

but this is not

methodCall(option1:true
option5:false
)

the last example is the same as

methodCall({option1:true,option5:true})

while

methodCall(option1:true
option5:false
)

is equivalet of

methodCall({option1:true},{option5:false})

So to sum it up
indentation level can be used to separate object arguments in CoffeeScript.

beeScript

In one of my previous posts I wrote about beeScript.
BeeScript is meant to be an automation language for diskotek.
This post is a more detailed description.
Right now it is in early development so this is the description of how it is developed and what state it is in.
This is a list of what is currently implemented regarding the communication with the backend:

  • reading memory
    place=0x80000000
    a = memory.place

  • sending gdb commands
    s ni
    s disas /rm $eip-40, $eip+40

One can use control flow structures, function definitions, variable definitions, expressions.
Some might be developed further.

now the look on the internals of how it all works

  • parser is jison generated and is located in beeScript.jison
  • interface for code generator is located in compiler.coffee.
    it contains bunch of functions that are called when parsers productions are reduced. That class is meant to bee extended
    by any code/ast generator.

beeScriptRunner & stack machine vm

example of one such generator is in beeScriptRunner.coffee. It is a generator for stack machine vm written in coffee script.
The stack machine vm has two stacks.

  • expression stack. Used to calculate and assign stuff
    @stack
  • call stack. Used for method invocation
    @callStack

variables are stored in

@variables

@variables is an object whose properties are variable names

name:{
name:
value:
}

functions are stored in

@functions

there is also diskotekLib that is an object containing functions that interface with the backend.
It provides easy extensiblity for the script one can use functions from it by just calling them like functions defined in beeScript.
There is only one argument passed that is ref to expression stack like so.

f(@stack)

Parameters are on the stack so one just needs to pop them.
Care must be taken to leave the stack in state so that rest of the code works.
One would define a function with python like syntax without the : at the end like so

def func(param1, param2)
param1 = param2
f=func()

It is important to put that newline at the end of the function. That newline means end of a function. That may be slightly modified.

Arguments are searched first in function block and then global scope. That may change.
There are special variables:

memory
eax,ecx,edx,ebx...

That list may change.
Memory special variable can be used for reading from and writing to memory.
This is an example of reading:

//create a variable that has an address from where to read memory from
memoryLocation = 0x80000000
//read from memory
contentsOfMemLocation = memory.memoryLocation

In the background reading works like cache memory with block access. First it tries to access location if it is not there it asks the backend.
What is returned is a dictionary that looks like this
Then calls access function one more time and gets it.

This is an example of writing:

//create a variable that has an address where we want to write to memory
memoryLocation = 0x80000000
//assemble and write to memory
memory.memoryLocation = 'nop'

This post may be updated so that it can be used as a reference for the beeScript in the future.

Requirejs Module and Angularjs

here is a way of including requirejs package to be used as angular dependency.