Showing posts with label codebug. Show all posts
Showing posts with label codebug. Show all posts

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

Monday 1 August 2016

Micro:bit and Glowbug


I saw on Twitter that some people have got the GlowBugs, more commonly used the CodeBugs (http://www.codebug.org.uk/learn/activity/73/glowbugs/), to work with the Micro:bit. Here is my go at doing it. I just wanted to get one GlowBug to flash Red, Green and Blue and keep cycling around.

The start point was to base it on the code from http://microbit-micropython.readthedocs.io/en/latest/neopixel.html for using Python with neopixels. The GlowBugs are essentially a single neopixel. So I connected the Data In to pin 0 and set the strip length to 1 ( np = neopixel.NeoPixel(pin0, 1) ) and then set the colours by setting np[0] to the colour wanted (eg. Red  np[0] = (255, 0, 0) ).


from microbit import *
import neopixel

# Setup the Neopixel strip on pin0 with a length of 1 pixel
np = neopixel.NeoPixel(pin0, 1)

while True:
    np[0] = (255, 0, 0)
    np.show()
    sleep(1000)
    np[0] = (0, 255, 0)
    np.show()
    sleep(1000)
    np[0] = (0 , 0 , 255)
    np.show()
    sleep(1000)


Video of it in action.




  


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.

Sunday 26 June 2016

CodeBug at code club




These little devices provide something different to a code. To see the coding interface go to http://www.codebug.org.uk/ (or see figures 1 and 2) and click on create.



Last two weeks
Week 1 
The code clubbers initially shared machines, playing with the CodeBug environment, practice downloading to the bug, writing a routine to scroll their short message. The challenge was then to develop a routine to have a smiley face and a grumpy face scroll across the screen.


Week 2
All have access to the simulation and code generation on codebug.org.uk but this time they don’t have the CodeBug each, they have complete a challenge and run it on the simulation before get a CodeBug to try it. This week's challenge was to get the smiley and grumpy face from week 1 to be selected via the buttons (A and B) - so it involved a loop and conditional statements. Most of them picked it up very quickly.

Two version were built - I reconstructed the ideas in figures 1 and 2 (the code clubbers often did a better version than mine shown here!).

Figure 1: Simple Scroll
The one shown in Figure 1 works by pressing A -scrolls :-) and B - scrolls :-( . Some spotted that the the 'nose' wasn't quite in the place. Some went and found the build sprite block and used that instead.
Figure 2 - Using the build sprite.




Lessons learnt
  • Give them all access individually to the CodeBug website but not to the physical CodeBug straight away
    • They are often a limited resources
    • There is a great temptation from the code clubbers to focus on download to the actual device when the seem to get more done if the spend more time with website and its simulator first;
    • When they have something interesting to put on the ‘bug’; then they can borrow a bug and try it out.
  • They should do a bit of show and tell.

Related posts
Basic Motor Control using CodeBug
messing around with Codebug




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.

Monday 20 June 2016

Basic motor control using CodeBug



A simple transistor circuit is used here to get the CodeBug to control a small motor, turning it on or off.
Drawn using Schemeit (http://www.digikey.co.uk/schemeit/project/

The motor used here was a small cell-phone vibration motor, but it has been tried with other small motors.




Using ‘leg 1’ to switch the motor on or off, +5v comes from the CodeBug PWR connector and GND come from the CodeBug. It can only drive the motor in one direction.

In the code below Button A switches on the motor and Button B switches the motor off.






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.

Top posts on this blog in March 2024

The Top 10 viewed post on this blog in March 2024. Covering areas such as small robots, augmented reality, Scratch programming, robots. Micr...