Sunday 14 March 2021

Initial experiments with Code Bug Connect




Code Bug has been around for a while, and it is incredibly cute, When it first came, it was a very interesting piece of kit - and it is still is and fun to play with. It spec means it is still a very useful piece of kit.

  • 5x5 Red LED display
  • 2 buttons
  • 6 touch sensitive I/O pads (4 input/output, power and ground)
  • Micro USB socket
  • CR2032 battery holder
  • Expansion port for I2C, SPI and UART
  • Blockly-based online programming interface
  • CodeBug emulator for checking code before downloading

In 2020 Code Bug launched and successfully funded a Kickstarter campaign (https://www.kickstarter.com/projects/codebug/codebug-connect-cute-colourful-and-programmable-iot-wearable ) for a new version the Code Bug - CodeBug Connect with a serious upgrade.(and the name Connect is highly appropriate with USB tethering and Wifi capability in this version. The technical specification (taken from their site https://www.kickstarter.com/projects/codebug/codebug-connect-cute-colourful-and-programmable-iot-wearable ) shows how much of an upgrade this is:

  • 5x5 RGB LEDs with dedicated hardware driver/buffer
  • Two 5 way navigation joysticks
  • Onboard Accelerometer
  • 4 GPIO legs, including high impedance sensing for detecting touch (think  MaKey MaKey TM)
  • 6 Sewable/croc-clip-able loops. 4 I/O including analogue 1 power and ground
  • 6 pin GPIO 0.1" header (configurable for UART/I2C/SPI, I2S or analogue audio out)
  • QuadCore -- four heterogeneous processors
  • 4MB Flash Storage
  • 2.4GHz WiFi 802.11 b/n/g, Station and Soft AP (simultaneous)
  • Experimental long range wireless 0.8km to another CodeBug Connect
  • UART terminal access over USB
  • High efficiency SMPS Boost convertor for battery (JST PH connector)
  • High efficiency SMPS Buck convertor from 5V USB


Recently the early version of the Connects have been arriving and it is cool (IMHO). 


The getting going guide  https://cbc.docs.codebug.org.uk/gettingstarted/quickstart.html lives it up to its name and does a better explanation of doing this than I can provide here.



First I played with the USB and the blockly style programming tool https://www.codebug.org.uk/newide/ (see above) essentially producing a very slightly modified version of their starter code. You can perhaps see the Python style coming in with the while True coming in. Works well and it showed one of the different between this version and the older one; the LEDs are now colourful instead of red only. Programming it, while using the laptops USB to power it does lead to pulling the cable in and out to get the code to run - but that is fine and is clearly explained in the guide

You can connect it via wifi to a phone or a laptop so tried it with a phone. The getting started guide explains it well and the online editor allows you to program in micropython and example is shown below


import cbc

from color import Color

import time


while True:

  cbc.display.scroll_text(str(" Bug 1"), fg=Color('#f0ff20'))

  time.sleep(1)

 


They have even thought about security. I set my system to connect via wifi through my phone; but when I want to connect through my laptop I had to go through  the adoption process to try it on my phone and a laptop - sounds scary but it is well explained in the getting going guide and is relatively simple to do.


Looking forward to exploring the device a lot more, the guide also includes a number of code examples to play with and explore. A feature I particularly liked was seeing the block code rendered as python when using the editor on the phone.



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

Saturday 6 March 2021

Make yourself a virtual gallery




This short post builds on the previous posts (below), unless you have used A-Frame before please have a look at these:


Using Glitch  (https://glitch.com/) as a web development and hosting tool. We are going to create the start of a virtual Gallery, essentially 4 rectangles that images can be posted on, a cylinder that also images can be wrapped around and the floor and the sky.

To do it following is posted into the index.hml
<html> 
<head>   
 <script src="https://aframe.io/releases/1.2.0/aframe.min.js">   </script> 
</head> 
<body>   
  <a-scene>     
    <a-box position="-1 2 -1" 
rotation="0 -30 0" color="white" depth="2" 
height="4" width="0.5" 
src="https://cdn.glitch.com/febf6408-3c33-4608-ac90-b087753e5792%2Fpanic.png?v=1573395380360"></a-box>     
   <a-box position="-4.5 2 -1" 
rotation="0 -30 0" color="white" depth="2" height="4" 
width="0.5" 
src="https://cdn.glitch.com/e7ab4c95-5e85-4dc0-9bee-da6f7e87efcf%2Fdiginorth1.PNG?v=1615066351771"></a-box>     
   <a-box position="-1 2 -6" 
rotation="0 -30 0" color="yellow" depth="2" 
height="4" width="0.5" 
src="https://cdn.glitch.com/425c1a98-7ba9-463d-817d-6b491a516246%2F97b3bf6d-ced1-4041-80d4-b6c9a98ba43d.jfif?v=1614341330757"></a-box>     
   <a-box position="-4.5 2 -6" 
rotation="0 -30 0" color="white" depth="2" 
height="4" width="0.5" 
src="https://cdn.glitch.com/e7ab4c95-5e85-4dc0-9bee-da6f7e87efcf%2Fvex2.gif?v=1615066487037"></a-box>     

<a-cylinder position="1 0.75 -3" 
radius="0.5" height="1.5" color="#FFC65D" src="https://cdn.glitch.com/e7ab4c95-5e85-4dc0-9bee-da6f7e87efcf%2FPicture1.png?v=1615066388587"></a-cylinder>     

<a-plane position="0 0 -4" 
rotation="-90 0 0" width="20" height="20" color="#7BC8A4"></a-plane>  

<a-sky color="white"></a-sky>   

</a-scene> 

</body>

</html>








Now to change the images all you need to do is change the URL in the src="". If you are doing this in Glitch it is easier often to copy the images into the asset folder and copy the URL produced.




Ideas to take this further 
  • Rotate the cylinder so the image can be seen completely from a standing position.
  • Wrap an image on the floor, sky or on a new shape.

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

ChatGPT, Data Scientist - fitting it a bit

This is a second post about using ChatGPT to do some data analysis. In the first looked at using it to some basic statistics  https://robots...