Sunday, 29 January 2017

my robot BETT2017

I will start with a confession, I only had about 2 1/2 hours at BETT 2017 due to external time pressures so to say I didn't yet a chance for a good (or even a bad) look around is an understatement; so I am not reviewing the show just a few notes on what I did manage to see.


STEAM Village
First and mostly, it was great to talk to so many people, only few I had met face to face previously, about robots, micro:bits, Raspberry Pis and coding. Most of this happen in the relatively small (compared to the event space) STEAM village and nearby stalls. It was great to see the strong presence of both Raspberry Pi and Micro:Bit Foundation, along the variety of different activities and example usage of both, with Code Club (I know it is part of Raspberry Pi Foundation) there was well. This was all alongside some other companies

Four of these stuck in my mind.

1. DFRobot (https://www.dfrobot.com/) with their range of Arduino-based robots and non-programmable kits. The two kits that caught my eye was the FlameWheel robotics kit (to see more on this go to https://www.dfrobot.com/index.php?route=DFblog/blog&id=563) and the Insectbot kit (see the video below). As an aside, I recently got one of their new designs Antbo through a crowdfunding offer https://www.indiegogo.com/projects/antbo-an-insect-robot-anyone-can-build-steam-diy/ (more this in a future post)




2. School of Code (http://schoolofcode.co.uk/) with their web-based coding but with the emphasis on collaborative coding was great to see. Have at go for yourself at their character building example http://www.schoolofcode.io/game-avatar, done as part of the Hour of Code, it is good fun.


3. It was great see GitHub were there was as well, and they couldn't be more generous with the stickers and other materials. I wish I had more time to talk to them.

4. Last but not least was CBiS Education (http://www.cbis.education/) with an extremely tall model of their DIMM robot. I think their products are interesting, here are a few earlier posts about projects with their products Robot Arm and Python, UFO talks to Robot part 1, UFO talks to Robot part 2).


Outside of the STEAM village
There were two stands that particularly caught my attention.

Robots In Schools Ltd (I wish I own that name) with their Edbot package - a single Edbot but networked so the teacher can share access to the robot by assigning control to the students machine. I really liked this idea. For more details go to: https://robotsinschools.com/inclassrooms/.

Second was Ubtech (http://ubtrobot.com/) with their Alpha 1 and 2 (more on Alpha 2 in a future post). What I found most interesting was their ideas of potentially embedding Raspberry Pi or Arduino inside their Alpha 1 for a more open source solution.


Would I go back next year? 
Yes please, but I just want a day or more there though next time.  

All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Friday, 30 December 2016

Neuron Controlled Edge follower updated

In the last post experimentation with an artificial neuron controlling the Bit:Bot to follow the edge of a line (it follows the left-hand side of the line).




More details can be found in the previous post.The neurons (well two separate ones, S1 and S2) are produced using weighted sums - summing the weights x inputs [ right-hand sensor (rs) and left-hand sensor (ls)] plus a bias for each neuron in this case w[0] and w[3].
    net=w[0]+w[1]*rs+w[2]*ls      
    net2=w[3]+w[4]*rs+w[5]*ls


If weighted sum >=0 then its output 1 otherwise 0


What actual causes S1 to be either 1 or 0 is all defined by a set of weights w (three for the first neurone, S1,  three for S2).

w=[0,-1,1,-1,1,-1]


Modifications to the code in the last post have been around fine tuning the values in converting the outputs of the two neurons S1 and S2 into actions as shown below.
    if s1==1 and s2==1:
        forward(20)   
    elif s1==0 and s2==1:
        forward(15)
        right_turn(25)
    elif s1==1 and s2==0:
        forward(15)
        left_turn(25)       
    elif s1==0 and s2==0:
        backward(5)

The functions for forward, right_turn, etc are defined elsewhere.


To change the function of the system, change the values in wThe complete code is shown below.


Code
from microbit import *
import neopixel, random, array

w=[]  

def forward(n):
    pin0.write_analog(551)
    pin8.write_digital(0) 
    pin1.write_analog(551)
    pin12.write_digital(0)
    sleep(n)
    
def backward(n):
    pin0.write_analog(551)
    pin8.write_digital(1) 
    pin1.write_analog(551)
    pin12.write_digital(1)
    sleep(n)
    
def right_turn(n):
    pin0.write_analog(511)
    pin8.write_digital(0) 
    pin1.write_analog(511)
    pin12.write_digital(1)
    sleep(n)
    
def left_turn(n):
    pin0.write_analog(551)
    pin8.write_digital(1) 
    pin1.write_analog(551)
    pin12.write_digital(0)
    sleep(n)
       
w=[0,-1,1,-1,1,-1]

while True:
    ls= pin11.read_digital()
    rs= pin5.read_digital()
    
    net=w[0]+w[1]*rs+w[2]*ls
    net2=w[3]+w[4]*rs+w[5]*ls

    if net>=0:
        s1=1
    else:
        s1=0

    if net2>=0:
        s2=1
    else:
        s2=0
   
    if s1==1 and s2==1:
        forward(20)   
    elif s1==0 and s2==1:
        forward(15)
        right_turn(25)
    elif s1==1 and s2==0:
        forward(15)
        left_turn(25)       
    elif s1==0 and s2==0:
        backward(5)


Video of it in action:






Please feel free to use the code and improve on it, and I would especially welcome the seeing the improvement through the comments.



All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Friday, 23 December 2016

4Tronix Bit:Bot Neuron Controlled Edge follower

In the last post I was playing with 4Tronix's Bit:Bot. In this post I will show the initial experimentation with an artificial neuron controlling the Bit:Bot to follow the edge of a line (it follows the left-hand side of the line).



The neurons (well two separate ones, S1 and S2) are produced using weighted sums - summing the weights x inputs [ right-hand sensor (rs) and left-hand sensor (ls)] plus a bias for each neuron in this case w[0] and w[3].
    




              


    net=w[0]+w[1]*rs+w[2]*ls      
    net2=w[3]+w[4]*rs+w[5]*ls


  If weighted sum >=0 then its output 1 otherwise 0
    if net>=0: 
        s1=1
    else:
        s1=0

    if net2>=0:
        s2=1
    else:
        s2=0

What actual causes S1 to be either 1 or 0 is all defined by a set of weights w (three for the first neurone, S1,  three for S2).

w=[0,-1,1,-1,1,-1]



Converting the outputs of the two neurones S1 and S2 into actions is shown below.
    if s1==1 and s2==1:
        forward(40)   
    elif s1==0 and s2==1:
        forward(30)
        right_turn(10)
    elif s1==1 and s2==0:
        forward(30)
        left_turn(10)       
    elif s1==0 and s2==0:
        backward(40)

The functions for forward, right_turn, etc are defined elsewhere.


At the moment the movement is a bit rough and it is a little simpler to build a version that follows the centre of the line; this approach though, works with thinner lines. 

To change the function of the system, change the values in w; for example to produce one that follows the centre of the line just change w (I will leave that to someone to work on). The complete code is shown below.


Code
from microbit import *
import neopixel, random, array

w=[]  

def forward(n):
    pin0.write_analog(551)
    pin8.write_digital(0) 
    pin1.write_analog(551)
    pin12.write_digital(0)
    sleep(n)
    
def backward(n):
    pin0.write_analog(551)
    pin8.write_digital(1) 
    pin1.write_analog(551)
    pin12.write_digital(1)
    sleep(n)
    
def right_turn(n):
    pin0.write_analog(511)
    pin8.write_digital(0) 
    pin1.write_analog(511)
    pin12.write_digital(1)
    sleep(n)
    
def left_turn(n):
    pin0.write_analog(551)
    pin8.write_digital(1) 
    pin1.write_analog(551)
    pin12.write_digital(0)
    sleep(n)
       
w=[0,-1,1,-1,1,-1]

while True:
    ls= pin11.read_digital()
    rs= pin5.read_digital()
    
    net=w[0]+w[1]*rs+w[2]*ls
    net2=w[3]+w[4]*rs+w[5]*ls

    if net>=0:
        s1=1
    else:
        s1=0

    if net2>=0:
        s2=1
    else:
        s2=0
   
    if s1==1 and s2==1:
        forward(40)   
    elif s1==0 and s2==1:
        forward(30)
        right_turn(10)
    elif s1==1 and s2==0:
        forward(30)
        left_turn(10)       
    elif s1==0 and s2==0:
        backward(40)
       
           
    




All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Who wants to produce AI produced cartoon strips

Question: How easy is it produce a comic/cartoon using genetative AI? Let's start with  using ChatGPT4o to produce cartoons. The idea wa...