Articles Hierarchy

Articles Home » Arduino Projects » Arduino teaching

Arduino teaching



- intro
- OPI
- detail docu
- install ( old way ) and start "bloq" coding
- online compilation (new way)
- scratch / blocks / bloq
- tutorial 1 basic projects



Intro:


A recent processing code project lead to the sponsoring of this article.
I received 2 - Zum Kit produced by the Spanish company BQ
- - I will use one kit while researching and producing content for this tutorial
- - The second will be used by my 14 year old nephew who will be learning about hardware and programming as we explore the Zum kit.
(I really hope he loves this project)
This kit is not just a box of toys. It comes with an online development environment and student / teacher materials.
Unfortunately, it is rumored that this kit may be out of production?



OPI:


Open Packet Inspection (unboxing )



Detailed documentation:


The board
The Kit

This blog has reviewed and tested several types of “official” Arduino and 3rd party boards over the years.
It will be interesting to investigate the differences between an Arduino UNO and the Zum board.
A summary of Zum’s major differences:

-a- Bluetooth: A very interesting feature.
-b- Power switch: "to disable connected devices while programming" ? no seems to be a real OFF (i hear the serial port come on/off)
-c- Increased input current (amp): ( ? per pin out? )
Note: The Zum kit includes a USB cable and a battery-pack that holds 8 AAA batteries. It did not include an external power supply.
-d- 3 Pin Array Sets: Zum includes its own set of sensors/actors, we hope these features are compatible with 3rd party vendors.



Install & start Coding:


+ Let’s begin by checking the BQ Bitblog website: https://bitbloq.bq.com/#/
- Note: Google Chrome is the suggested browser

+ Register for an account and login:

+ Enter a bit of test code and trying uploading to the Zum board.

+ Here we are given the option to download a Windows driver installer:
graphical_installer-qssweb2board3.5.0-Windows.exe ( 129MB )
(Perhaps this package includes the official Arduino IDE?)

installation:



Three of the four install items generated errors




The installation will be flagged by Windows Defender – here we need to grant permission.

Ok – now what’s next?
Let’s unpack the Zum board, plug in the provided USB cable and connect to the PC.
Any USB-2 port will work as the basic board does not require much power.
Initially the board did not react (no green LED power indicator) resulting in a brief moment of worry.
I toggled the power switch but still had no response.
Next, I re-seated the USB micro connector on the Zum board – slightly changing its angle.
That fixed the issue – the green LED lit up and the “D13” LED started blinking. What a relief!





In the next section we will be using the Arduino IDE (we are using version 1.8.12)
and on our system we are connecting the Zum’s USB interface to COM3.
board info:BN: Unknown board
VID: 10C4
PID: EA60
SN: Upload any sketch to obtain it

Next we update to the newest version:

Initially, the Arduino IDE board manager did not recognize the Zum board.
Luckily there is an installer that adds BQ ZUM to the Arduino IDE.
The procedure is outlined here and now, after 3 steps, can select board BQ ZUM Core
in the Arduino board manager.



In this section we return to the BQ online environment:
Let’s create there a little project using the online editor and try uploading the compiled code to the Zum board.
Next, we are asked to start the prior installed software locally: click [Open qssweb2board]

The software loads and we see the following window:

…again Windows Defender requires permission

problems with a first setup i documented here
in a second setup it worked:



new way: online compilation:


when you open your account there is a setting at the end of the page:
enable online compilation, means a upload does not need the web2board software installation.


using Chrome browser also must install this extension .
i try on a PC where i had install problems and could upload a sketch,
even the chrome browser seems to be hanging and not finishing that procedure.
a browser restart is required here, but it works now also on this computer.


Scratch / Blocks / Bloq:


did you ever play with this SCRATCH like ( here bitbloq ) graphic way of programming?
Scratch is a block-based visual programming language from MIT
it might be the future of coding as it makes programming independent from language
* * like i could online use blocks with german text ( try language select ),
but after verify, get on PC a normal .english. arduino C/C++ code,
what finally kills the english dominance in programming languages / compilers..
as that part ( source code and compiling ) is just pushed into the background.
you select graphic blocks ( pictures ) that can carry many languages ( possibly yours too )

but sure your comments and variables and function names might cause headache
if your program is viewed via a other language.

but in our case here, sorry in bitbloq you can not select THAI language until now.

i also checked on Scratch 3 there are more languages available,
on my RPI:

online in browser:


please, do not blame the developer of that program ( BQ.com ), language support is always a local issue,
like that some coder groups / companies / universities understand the importance
to support selected tools for their local students... and provide like thai language / translation packs,
yes, for FREE !
nothing you can make money with, but something you could be proud of.



Tutorial 1- Basic Projects:


Arduino projects are mostly a combination of a micro controller board
with ( hardware ) sensors and actors connected.
even you can/want not use the bitbloq 'language',
the Arduino C/C++ has not much from the C language besides the syntax and math commands.
mostly you need to know the Arduino library commands to address the In / Output pins, see the
reference

syntax:document syntax:
// one line comment
/* multi line comment */

Function Call syntax :
myVariable = someFunction( someParameter, or, more );
Control Structure syntax:
if (condition) {
//statement(s)
}
Program Structure syntax:
// library includes
// variable declaration
void setup() {

//statement(s)
}
void loop() {

//statement(s)
}

( sorry, this web site can not show the good formatted Arduino code correctly,
so usually i just copy code to text file and link to it from here, but for a tutorial might be not best way )


Tutorial 1- 1: control one LED


T1_1/*** Included libraries ***/

/*** Global variables and function definition ***/
//________________________________________________________ pin definition
const int LED1_d6 = 6;

int LON = 1; //___________________________________________ try same program again using here a boolean variable type

/*** Setup ***/
void setup() {
pinMode(LED1_d6, OUTPUT);

}


/*** Loop ***/
void loop() {
switch (LON) { //_____________________________________ write the output depending on a variable setting
case 1:
digitalWrite(LED1_d6, HIGH);
break;
case 0:
digitalWrite(LED1_d6, LOW);
break;
}

}



Tutorial 1- 2: LED blinking timer


T1_2/*** Included libraries ***/

/*** Global variables and function definition ***/
//________________________________________________________ pin definition
const int LED1_d6 = 6;

int LON = 1; //___________________________________________

/*** Setup ***/
void setup() {
pinMode(LED1_d6, OUTPUT);

}


/*** Loop ***/
void loop() {
switch (LON) {
case 1:
digitalWrite(LED1_d6, HIGH);
break;
case 0:
digitalWrite(LED1_d6, LOW);
break;
}

delay(1000);

if ( LON > 0 ) { //_________________________ toggle
LON = 0;
} else {
LON = 1;
}
}



Tutorial 1- 3: with serial debugging messages


T1_3/*** Included libraries ***/

/*** Global variables and function definition ***/
//________________________________________________________ pin definition
const int LED1_d6 = 6;

int LON = 1; //___________________________________________

/*** Setup ***/
void setup() {
pinMode(LED1_d6, OUTPUT);

Serial.begin(9600);
Serial.println("Hallo World, i am Arduino Zum Core 2.0");
}


/*** Loop ***/
void loop() {
switch (LON) {
case 1:
digitalWrite(LED1_d6, HIGH);
break;
case 0:
digitalWrite(LED1_d6, LOW);
break;
}

Serial.println(LON); //_____________________ diagnostic

delay(1000);

if ( LON > 0 ) { //_________________________ toggle
LON = 0;
} else {
LON = 1;
}
}



Tutorial 1- 4: POTI input, by limit control LED


now we use a Analog Input, where we connected a potentiometer to A0 pin.
electrically Arduino can read signals from 0 .. 5 VDC,
and understand ( integer ) 0 .. 1023, that would be 5mV steps.
if you convert the integer number back to real number ( to show [V] )
and print it to console ( 5.00 ) you would loose resolution.
here can use like Serial.println(Voltage ,3); to see ( 5.000 )

T1_4/*** Included libraries ***/

/*** Global variables and function definition ***/
//________________________________________________________ pin definition
const int POT1_A0 = A0;
const int LED1_d6 = 6;

int A0_in = 0; //_________________________________________ hold POTI reading value 0 .. 1023

/*** Setup ***/
void setup() {
pinMode(POT1_A0, INPUT);
pinMode(LED1_d6, OUTPUT);

Serial.begin(9600);
Serial.println("Hallo World, i am Arduino Zum Core 2.0");
}


/*** Loop ***/
void loop() {
A0_in = analogRead(POT1_A0); //_______________________ read poti hardware via analog input
Serial.println(A0_in); //_____________________________ diagnostic print

if (A0_in > 512) { //_________________________________ switch LED depending on limit
digitalWrite(LED1_d6, HIGH);
} else {
digitalWrite(LED1_d6, LOW);
}
delay(500); //________________________________________ read 2 times per second
}




Tutorial 1- 5: POTI input and LUX input, by limit control LED,
Button overwrites it
we build a Automatic Night Light


T1_5/*** Included libraries ***/

/*** Global variables and function definition ***/
//________________________________________________________ pin definition
const int POT_A0 = A0;
const int LUX_A1 = A1;

const int LED_d6 = 6;
const int BUT_d7 = 7;

int POT = 0; //___________________________________________ hold POTI reading value 0 .. 1023
int LUX = 0; //___________________________________________ hold LUX reading value 0 .. 1023

boolean BUT = false; //___________________________________ hold Button reading, pressed is true

/*** Setup ***/
void setup() {
pinMode(POT_A0, INPUT);
pinMode(LUX_A1, INPUT);
pinMode(BUT_d7, INPUT);

pinMode(LED_d6, OUTPUT);

Serial.begin(9600);
Serial.println("Hallo World, i am Arduino Zum Core 2.0");
}


/*** Loop ***/
void loop() {
//........................................................ Input cycle
POT = analogRead(POT_A0); //____________________________ read poti hardware via analog input
Serial.print("POT ");
Serial.print(POT); //___________________________________ diagnostic print

LUX = analogRead(LUX_A1); //____________________________ read poti hardware via analog input
Serial.print(", LUX ");
Serial.print(LUX); //___________________________________ diagnostic print

BUT = digitalRead(BUT_d7); //___________________________ get button status
Serial.print(", BUT ");
Serial.print(BUT); //___________________________________ diagnostic print

//........................................................ Logic and Output cycle
if ( (POT > LUX) || BUT ) { //__________________________ switch LED depending on limit setpoint by POTI but Button overwrites it
digitalWrite(LED_d6, HIGH);
Serial.println(": ON"); //____________________________ diagnostic print
} else {
digitalWrite(LED_d6, LOW);
Serial.println(": OFF"); //___________________________ diagnostic print
}

//........................................................ Program Timing
delay(500); //__________________________________________ read 2 times per second
}


Serial Monitor printHallo World, i am Arduino Zum Core 2.0
POT 84, LUX 245, BUT 0: OFF
POT 83, LUX 244, BUT 0: OFF
POT 85, LUX 243, BUT 0: OFF
POT 85, LUX 121, BUT 0: OFF
POT 84, LUX 117, BUT 0: OFF
POT 84, LUX 154, BUT 0: OFF
POT 85, LUX 128, BUT 1: ON
POT 84, LUX 132, BUT 1: ON
POT 84, LUX 124, BUT 0: OFF
POT 85, LUX 122, BUT 0: OFF
POT 84, LUX 104, BUT 0: OFF
POT 84, LUX 177, BUT 0: OFF
POT 85, LUX 70, BUT 0: ON
POT 83, LUX 66, BUT 0: ON
POT 83, LUX 71, BUT 0: ON
POT 83, LUX 241, BUT 0: OFF
POT 85, LUX 241, BUT 0: OFF





not nice, this flying wiring, much more easy as a breadboard,
but a pin board to hold that things might be good,
or reuse some plastic from the last dinner shopping, add i still had a bag of screws ( 30mm long, 3mm thread )
under and above the board as spacer i used 7mm long cuts of clear aquarium air hose.
while Arduino Uno boards only have 4 holes, Zum core 2 has 8?? i used all here.


later more to this...
but also i have the idea that the Zum Box Advanced already has a not cheap paper carton and plastic box with
handle, inside 2 stacked plastic holder for many items...
so why not just put in little bit more effort and make it in a way that all that good "packing and storing" material
could be used to BUILD something ( from project board / sensor holder... to robot body )
OR also a good idea i see lately here



on BitBloq
here i already used a different way about the printed lines,
adding info up in a string variable
diag += " more ";
and at end send it with one
Serial.println(diag);





Tutorial 1- 6: same but with printed LINE CHART


T1_6 on BitBloq




Tutorial 1- 7: add a buzzer


sound when Button is pressed with a tone depending on the potentiometer setting.
the here used tone function takes over all the difficult programming and timing
for sending pulses to a digital output.


const int BUZ_D8 = 8;

if ( BUT ) {
tone(BUZ_D8, POT, 500);
}




Tutorial 1- 8: HOME WORK


now the night light logic is ON OFF ( on the difference between LUX sensor and POT sensor )
change to
dim the LED
++ to On at sundown and
- - to OFF at sunrise



Tutorial 1- 9: learn about using functions


besides modularity and the idea to use your functions again in a other program,
with some good names, functions make your MAIN ( in Arduino called 'void loop(){}' )
structured and readable ( even without using comments )
bitbloq online T1_9



Tutorial 1- 10: wait, the ZUM Kit has more to offer... play IR


you might have noticed the IR sensor, hm i have actually no idea what to do with that?
but that makes it interesting! reading the BQ DIWO tutorials there you should test
to "look" with that sensor on a white sheet paper and then place your hand in the 'beam'.
and in a spanish video show the calibration ( sensor board adjustment ) to detect black
for a robot to find its way?

actually infra red led emitter and receiver are mostly used for communication ( remote control )
would that be possible with this boards ( sensors )?

so lets just experiment with it, IR sensor D2 & D3 and the monitor show status
bitbloq T1_10
on the back of the board is a calibration poti and a LED, OFF read 1 / ON read 0

for first play just moved the hand in front of the sensor LEDs.


Tutorial 1- 11: the Ultra Sonic


while the IR is supposed to read ( switch on ) color / light?..
the ultra sonic sensor has to measure a distance..
But why it is connected to D_in ( D4 here ), how can that work?
what the bitbloq system is hiding (in a library function #include < BitbloqUS.h > ) might be this

bitbloq T1_11
the print shows the distance ( to my hand ) integer 0 .. 87 ?[cm]? nothing to adjust there anyway, the back just shows 3 IC.


Tutorial 1- 12: SERVOS


NOTE: up to now i have all sensors connected to the board, even i make in the last projects only code for 1 sensor,
i keep all hardware connected and powered by my PC USB port cable to Zum Core 2 board.

but for the next projects
using the servos
i better give some power to the board:
a mobile robot would run on battery, but for the first code/ servo hardware tests i want use a old Arduino PS.
there are:
2 * small 180 deg servos model EMAX ES08AII
2 * big Continuous Rotation SpringRC SM-S4303R incl. 7cm diameter wheels
( what by separate control would drive and possibly even steer, still for a car would need 1 or 2 more passive wheels ).

please note: even with add power supply the servos are still connected to the 5VDC,
while for extra strong action 6VDC power to servos is possible/required
( but not with this board - power pin usage )

D08 the small one
D09 ( spare for the second )
D10 for the big one
D11 ( spare for the second )

D13 is the board LED ( but can be reused for some other things ... )
from here i find info:
D22 / D23: I2C1, SDA1: D22, SLC1: D23. add by Atmega 328PB cpu. should be usable as any D pin.

bitbloq online T1_12
(a)
beginning with convert POTI 0 .. 1023 to int 0 .. 180
and feed that to servo i see:
small ( analog ) servo:
- ( even without any coding ) every second vibrates little bit
- should not be operated in its limit ( 180 ) as it tries to position always ?more?
so better test YOUR servo and limit to 17x to prevent burn out ( but that is a known servo problem ).
- there is a [Oscillator] setting? but no speed setting.
(b)
the parameter for big servo ( bq-function ) clockwise / anti-clockwise ( inverted by purpose )
is translated as integer 0 / 180
i check by copy the POT reading into it, looks like small speed function ( 90 == stop with little window ?86 .. 95) or left or right, and then start slow,
possible when need power/work can see that better.
the servo.h lib and the Arduino doc and the online documentation for THIS servo explicitly talk about speed.

so for a motor here actually comes a bigger job:
we need a Motor Control Center code function with setpoints: start, stop, left, right, speed &
INTerlock/inhibit ? by timer ? endswitch ? process limit
feedback process values: ( no sensors so just by internal logic) INT, STOP, RUN ( left / right )
if the 2 motors running parallel for a car they will be mounted mirrored, so we also have to send
reversed direction ( 180 - dir )


Tutorial 1- 13: Bluetooth


now that is very new for me, first time i ever use Bluetooth, here ( even on a new mobile... )
-a- enable mobile Bluetooth
-b- install a app:

-c- send from bitbloq to Bluetooth ( function from components )
BUT ( in hardware ) delete the USB cable ... and not use a (external) Bluetooth module...
and send text lines..


find a bright BLUE LED blinking ( when sending )

bitbloq online T1_13

as a next step i try to get POT and LUX, make a CSV line out of it
,1023,1023,1023
and include a 'setpoint' send from mobile TO board

note the send value from mobile only shows once after sending.
bitbloq online T1_13b

one step more would be to type also a CSV line "1,2.34" could mean: "channel 1, setpoint 2.34 "
bitbloq online T1_13c


the decimals not printed here.



it worked, but still handling problems....
-a- must disconnect bluetooth ( and check BLUE BT LED stop ) or can NOT upload
-b- must close browser and wait until RED RX LED stop blinking
that 2 interfaces block each other, and often i can connect and get the BLUE blinking but see no line of text??


other question is the line length..
i could max send 13 chars in a line,
but with a timed for loop i could make this:



bitbloq online Test send long lines and still catch command


now i want combine that last test with T1_13c : BT & 2 analog as CSV,
and T1_6 LINE CHART
bitbloq online T1_13d






note: just for test i used a
+ + Raspberry Pi 4 / chrome browser / same sync ( extension and login )
+ + connected the "Zum core 2.0" board to USB and
+ + upload ( via bitbloq browser online compiling )
well, the extension is compatible, very good.