Coen De Roover Christophe Scholliers Yves Vandriessche
Software Languages Lab Vrije Universiteit Brussel Belgium
A tale of ubiquitous bears, flyswatters and punching bags in education Hello, my name is Coen De Roover from the Software Languages Lab of the Vrije Universiteit Brussel, Belgium. I’m here to tell you a tale of ubiquitous bears, flyswatters and punching bags in education. As you know, all good tales start with “once upon a time.” This tale is no exception. So here we go.
Once upon a time .. there was a language called Pico and some students initially hostile towards programming !
!
!
Once upon a time there was a programming language called Pico. It’s probably still remembered by many of you as Theo D’Hondt’s educational language in which the semicolon is a separator rather than a terminator ;) We were using it to teach principles of programming to the first bachelor of mathematics. As they hadn’t opted for computer science, we always tried to come up with assignments that would keep them motivated. For instance, simulating the drawings that are made by an harmonograph. It’s a device from the 19th century that uses a pendulum to create geometric images. The one that’s shown on the slide uses the pendulum to move a sheet of paper against a fixed pencil. However, not all students found these assignments equally interesting.
.. so we had to find a carrot but without the stick
μ-controller common in embedded systems 8-bit, AVR, 16Mhz 1KB SRAM, 16KB Flash convenient package cheap popular in digital arts
14 digital I/O pins, 6 analog I
Referencing the English saying “The carrot and the stick”, we wanted to find a carrot ---but without the stick. Something that would render programming appealing to a non-cs audience. We believe we found several of such carrots. The one on the slide is called Arduino. It consist of a microcontroller housed in a convenient package. For those not familiar with microcontrollers, you can think of it as a CPU (this one operating at only 16Mhz) that is put on a small chip together with memory and functionality to interface with sensors and actuators. They are omnipresent in intelligent microwave ovens, washing machines and the likes. The Arduino development board is a convenient package for such a microcontroller. There is, for instance, a USB port that provides power to the controller and that can also be used to communicate with a PC. The Arduino board comes with a nice development environment and is quite cheap. This explains its popularity in interactive art installations.
Swatting flies with the carrot
So we provided our little mathematicians with Arduino boards that we had programmed beforehand to send sensor data over the USB cable to the PC. Then we asked them to read out the sensor data in a Pico program, and put their creativity at work. This movie shows one of the results: a little game. The full circles represent flies. The big empty circle represents a fly swatter. By tapping on a piezo sensor (or clapping your hands), the swatter comes down and kills the flies beneath it. Because we received an overwhelming amount of positive feedback from the mathematics students, we started thinking about introducing the same carrot to our computer science students. With one little difference: the students would program the carrot themselves. And not in C, but in Scheme.
Birth of UbiLab phones, Lego robots, RFID readers, μ-controllers, wireless sensors
But first of all, we needed the hardware for all those students. The computer science department of the Vrije Universiteit Brussel decided to fund the necessary purchases such as microcontrollers, sensors, USB cables, LCD screens. But also Lego robots, RFID readers and hardware for wireless sensor networks. In short, all of the things that will realize the vision of ubiquitous computing that you heard about in the previous research-oriented talks. Note that all of this hardware can be borrowed freely by all of the students to be used for their course work.
UbiLab@soft teaching activities
μ to λ high school students λ on μ 1st bachelor students λ on μ 4 master student
Of course, the UbiLab hardware is also used by the other groups of the department. The Lego robots, for instance, are used by the AI and COMO people in their teaching activities. Since this is the SOFT event, however, I will highlight how we have been using the UbiLab hardware in three of our teaching activities. I chose these three because each of them is targeted at a different audience and each of them uses Scheme in a different manner. In the first activity, the microcontroller sends data to a Pico program. It is very similar to what I’ve shown before. We use this in PR workshops to attract high school students. In the second activity, the Scheme program actually runs on the microcontroller. We use this in the programming projects of our first bachelor students. The last activity represents the work of one of our master students. He ported Scheme to a multi-core microcontroller.
UbiLab@soft: μ to λ “I Love IT” workshops for high school students
In the first activity, several PR workshops designed to attract high school students to computer science, the microcontroller sends sensor data to a Pico program.
Each student is asked to modify a preprogrammed game, a Breakout clone, such that it uses the data from an accelerometer ---sent to the game by an Arduino--- to steer its paddle. Indeed, the microcontroller is used as a joystick for the game. I’ll let the movie explain what happens almost every single workshop. After a short explanation of the accelerometer that can also be found in the WiiMote and a playful introduction to programming, the students complete the game "Breakout" in which the accelerometer controls the paddle. Next, they experiment with different variants of the game that they program themselves such as strangely shaped blocks, a huge ball, a longer paddle ... all of which are shown to the other students with the necessary pride.
UbiLab@soft: μ to λ “I Love IT” workshops for high school students
Note that the students did all of this themselves after barely an hour of introduction to Pico ---which clearly highlights the educational merits of this programming language. Moreover, as evidenced by the movie, the students had a lot of fun completing the game as well. This feedback form, for instance, was very funny: although the girl says “me + computer = error”, she also says “thanks, it was very enlightening” and she is even handing out kisses on the form.
UbiLab@soft: λ on μ programming projects first bachelor students
The next teaching activity related to ubiquitous computing I’d like to discuss, is one in which we introduced the microcontroller in the programming projects of the first bachelor students of computer science.
UbiLab@soft: λ on μ a more powerful carrot
μ-controller 32-bit, ARM, 40Mhz 16KB SRAM, 256K Flash everything but the kitchen sink convenient package popular for prototyping embedded systems Each year, the first bachelors are asked to complete a programming project in Scheme. Although we wanted to expose them to ubiquitous computing hardware, our carrot to motivate them for this assignment, we didn’t want the experience to leave bad memories ---the proverbial stick. That’s why we needed a slightly more powerful carrot that could run an interactive Scheme interpreter, complete with garbage collector and read-eval-print loop, comfortably. We found the LPC2214 32-bit microcontroller on the Olimex LPC-H2214 development board more than capable of running the Scheme interpreter called “Armpit Scheme”.
UbiLab@soft: λ on μ project assignments 1st bachelor (define led-pin (ash 1 6)) (set-dir-output! GPIO_0 led-pin) (set-pin! GPIO_0 led-pin) Realisat
ie van e e
Ritmesp n el in Soft -
en Hard ware
Realisat ie
v
Virtueel an een Doolhof in Soft en Tweede D
Hardwar
e
eel Prog rammee rproject 2008-20 Eerste B 09 Twee achelor de zittijd
Realisat
!
Tweede Deel P Eerste B rogrammeerpro achelor ject 2009-20 10 Contact:
ritmespe
[email protected]
b.ac.be
Introduc tie Situerin g
Waar he t eerste deel van “ S tr u c tu het prog u r I” e rammee n “A lg o program rproject ri tm e n meerpro voornam e n d a ta je Situerin ct p rogramm elijk steu eerder st ru c tu re g nde op aan bij eren van n I” , le de vakke de cursu maat on geïntegre u n t d it n s “Interp twikkeld e rd e d e e l va sy e st Waar he re e h u m ta a it e v ti rd n het n o e ware én eren: va a I” a t eerste n w b a o arin rece d gekom n het do so deel van ft w “ S tr u c tu v a a re die en is. De n loopba orlopen nt he t het prog u r I” e samen é ze besta van mag nden in rammee n “A lg o én bepa fitnessce an uit op program netron- o Tweede rproject ri tm e n n a meerpro tr ld f a w e . v a Deel Pro o ta sp ornameli ak optim e n d a ta rogramm ject eerd Praktijk progra jk gramme aal a’s tot h ep et contro erprojecmaat mmeren van geïn er aan bij de c st ru c tu re n I” , le u steunde op to de vaakskseing leren te u n t rs o g t E n u re n erstetwB s “Interp dDitit d e e e rd ika k e e Introduc sy ld stemen retatie I” che h r rd deell vvaa n h e uitvoeren ware aan bod n het tp tie 20 : van heeloa w syastarin gekomen t doorlo07-2é0n08software d van loop ntaahet rogrammeerpro opcem is. Deze eem re pen van ie same banden m b n e ic m st ro in agnetron één bep Situerin aoallneuit ot van de opdra ject beoogt het co fi tn n tr e ss c entra. - of wasp aald g cht. Een r e p realisere anedeta n van e door mid rogramm rzaijkds optimanerzijds en een Praktijkto en geïn del van a’s b op de o enalde ha epassin toru t ghetut ssco vorm tegreerd Scheme p d Waar he rd ra g w c h enntrdoeleore a t program re a -c f t eerste o te mponen n omri n st s meerbare e p m ro m d g ten van en assort eel van ngende ra “ S tr u c tu D m it m d a e . d el van fysieke w het prog it systee iment se u r I” e het prog m. Same nsoren rammee ereld en n “A lg o program n realise rprosy rammee de abstra ri tm e n jestce meerpro op maa t evm ren zij d rp E o e ct ro o n e e rn je t n je w g c a v o c t beoog ereld va melijk stan de o microcon program t eerder d a ta st ru e e d e p ro n h e t Sc t het re gramme meren v c tu re n troller en eunde oppdracht. aan bij datastru heme aliseren erstijl, d an geïnte I” , le u nerzijds e de vakkEeen doo de cursaunderz cturen e maat on o v o a greerde t ij n r rd n d n n m e s d twikkeld s a e e it c id v b a “ n h e del van lgoritme Inte reota t ontwe n rmen de d e e l va op de o systeme e hardw uitvoeren n blijf t rp en e Scheme langgriejkïn. teM gre hardw ti n h e t pdracht n aabnrubg tusserp eeerrdnog are én en vera ook voo : van he w mpic af te ste roro aarinare od geknode oens I” -compo gco , de in ran software mtrmoellerb ntwoord r dit d t doorlo re p o n m van loop m c e ro m e m n e h ri n g te e n e r n t ra re n e keuze n van dit is. Dezegende fy zaere die sam mma. h n pen van a e t t ss t e banden b o v e e rt p n im erkte re eel van het p tuele teko en één bestaansieke we van systeem. e magnetr n in fitness t se roject u nsoren k rt e uit op reld en d bepaald S ko n on- of w a centra. m m -e in e In n it ndre gen alle iv e o e p id a a sl a ta sp li u b a se e a ro st g le en maar k optim capaciteit ermate re ra Praktijkto Een goe gramma n cr c te e z a ij w ti d v erew aal in de verf eiteit bij de prog ’s tot he van de ldaa epassin va rdnoh . het sam oer tdSeczhee rammee t controle g datastru enstellen ompedrach rstijl, do ren cturen e vaardigh t v o e a rd e n n n e a Dit deel d c h u belangri algoritm e n op e e ht ontw et syste nieke ka jk. Mee en blijf t em word erp en van het ns biedt n ludieke r nog, om de in een vera t aange manier in program ook voo systeem microcon moedigd d het afge n meerpro e r d op maa tw tr e o in d o p o it ll h ra er zet ev rde keu erent b , k lopen ja d ti ject beo e t van de jk e l to microcon v e ze van eperkte entuele te an het ar verwo te passe ogt het opdrach troller e n p re rven k . ro o k rt re je e t. k n a c n o t li erzijds e mingen a Een doo Individ seren va -e anderzij u n it e rm o p ate slagcapa n een o r u lleen ma ds vorm creativiten een geïnte citeit va p de op wamiddeel levan ar in de en de ha brug tuss greerd n de drachtard verf. rdware-c en de on or dezeSchemeit bij het sam af ote ompone e st o n s omring emmepndracht stellen v nten van ende assorte an het ee nnut nieke dit syste im systeem kans bie em. Sam wordt a dt om de en realise angemo in het afg ren zij d edigd, elopen ja e ar verwo rven
ie van e Introductie en
Virtueel H in Soft -
uisdier
en Hard
ware
In three successive years, we asked the students to program their carrot using Scheme. Each time, the goal was to realize a game that receives input from the physical world. In the first year, for instance, we asked them to create a Tamagotchi. You can think of it as a virtual pet that you have to feed and put into bed when it is sleepy etc. Using sensors, the game can be made a little more interesting. If the tamagotchi wants to sleep, for instance, the player has to cover a light sensor and make sure the accelerometer measures you rocking the Tamagotchi to sleep. Again, we received a lot of positive feedback from the students. Just in case you don’t believe me, I will let some of their creations speak for themselves.
UbiLab@soft: λ on μ project assignments 1st bachelor
Realisat
ie van e
Virtueel H
uisdier
in Soft -
Tweede D
en Hard
eel Prog r
Introduc tie
en
ammeer
ware
project E
erste Ba
chelor 2 007-200 8
Situerin
g
Waar he t eerste deel van “ S tr u c tu het prog u r I” e rammee n “A lg o program rproject ri tm e n meerpro voornam e n d a ta je c program t eerder elijk st ru c tu re meren v a a n n I” , le steunde op de v bij de c an geïnte maat on akken un ursus “In greerde twikkeld terpretati t d it d e e l va systeme e hardw n het n e I” wa are én arin rec software ent het die sam en één bepaald e taak optimaa l
In the first year, the year of the Tamagotchi assignment, some students went as far as stuffing a teddy bear with the microcontroller. This student, for instance, is demonstrating how you can navigate through the menus of the game using the arms and the nose of the bear.
UbiLab@soft: λ on μ project assignments
1st bachelor
Realisat
ie van e
Virtueel H
uisdier
in Soft -
Tweede D
en Hard
eel Prog r
Introduc tie
en
ammeer
ware
project E
erste Ba
chelor 2 007-200 8
Here are some other pictures from the same year. Clearly, putting a microcontroller in a teddy bear was very popular that year. The last picture stems from a student that preferred to focus instead on making the graphics fast enough such that you could play PacMan against the TamaGotchi.
Realisa
tie van
Ritmes
in Soft -
!
een
pel
en Hard ware
Tweede Deel Pr ogra Eerste Bachelo mmeerprojec t r 2009-2 010 Contact: ritmesp el@soft .vub.ac .be
UbiLab@soft: λ on μ project assignments 1st bachelor
Introdu ctie
Situerin g
In the third year, we asked the students to implement a rhythm game in Scheme on the microcontroller. One of them was extremely creative and housed his game in a punching bag. Again, the movie will explain the details. This is a punching bag housing a microcontroller, sensors and a display. Each boxing glove houses an accelerometer. The game's objective is to hit the punching bag when indicated by the display. Allow me to demonstrate. The rules of the game are shown first. The display shows multiple balls falling down. Hit the punching bag whenever a ball slides of the display. Some balls require you to give an uppercut. Others a jab. The gloves' accelerometers allow discerning both punches. As a student of computer science, Bram experienced few problems programming the game. But things had to be sewn together as well.... ... the accelerometers in the gloves ... ... patches in the punching bag. All to be enjoyed by people aged 7 to 77!
Realisa
tie van
Ritmes
in Soft -
!
een
pel
en Hard ware
Tweede Deel Pr ogra Eerste Bachelo mmeerprojec t r 2009-2 010 Contact: ritmesp el@soft .vub.ac .be
UbiLab@soft: λ on μ project assignments 1st bachelor
Introdu ctie
Situerin g
Another very creative student turned his rhytm game in a full-fledged drum computer. Again, the movie will explain the details. Crash, hi-hat, snare and a foot pedal function as sensors. The microcontroller itself is housed in a box with the LCD screen and leds. Note how the fonts of the menus scale with the amount of tracks a rhythm comprises ---even though the students had little more than a draw-pixel primitive at hand.
UbiLab@soft: λ on μ
Realisat
ie van e e
Ritmesp n el in Soft -
project assignments 1st bachelor
en Hard ware
!
Tweede Deel P Eerste B rogrammeerpro achelor ject 2009-20 10 Conta
ct: ritmes pel@sby Here are some more pictures from the same year. Housing the rhythm game in a self-contained box was popular that year. The assignment was inspired Tap Revolution for the iPhone. oft.vTap ub.ac .be
UbiLab@soft: λ on μ not just pretty, also good code procedur
Realisa
al abstrac
Ritmes
tions
finite sta
te machin
es
event str interrupt
eams
handlers
auto-pow
er on
tie van
een
pe in Realisa Soft - en Har l dware tie van een Tweed e Deel
VirtueeEe Program meerp lrsD te Bac roject ohoelolrh 200o Realisa in Soft 9-2f 010 tie! vanCon en Hard etaecnt: ritmesp ware VirtTuwee ede De el@soft el Prog .vub.ac e ramme l .be H erproje u 2 0 i 0 s 8 in Soft ct Eers Intro-2 d 0 0 9 i duc Twe er te B Tweed e
ede zit ti tijd Introdu en Hardw e ctie Situering are
achelo r
D
Siteueel riProgramW ng maeaer rp he t
erscte d “ S tr u c roeje e eers l va tu u r I” t E ten etcpro progra e n “A Bha heglorarm2m e e m rs lg o meerpro te deel 0e0e7rp-2ro0je “ S tr u c p ject ee ri tm e n e n tu u r I” rograva Situeri n 8 voornam h e m d a ta st 0ct t m erenpva progra rogram rder aan ng e elijk ste ru c tu re n mmeerp mnaa“A m lg o ri tm bij de geïnteegerpro unde o n I” , rouject t ontw e ik je cursus progra reerde ct vo p de va le u itvoeereerder keldne ehn o mmere “ sy d kken rn Waar ardwaata stemea maelijk Interpreta n t d it d e e l n st : n va a ru het eers maat va n re a c n n an bst én tu va eunde tie I” w he t b re ij eo n ïnpte so te deel ontwikke vannglo o d d d “ S tr u c o ft e I” o ware , le u gekom oe gn rlopecu redeerde pnde va aarin re n h e t rs tu u r I” uitvoe van he lde ha ba u n d s n ie t va n cent h “In is. kke n m samednit d stemen tenrp fitn progra ag e “Aren: vant programrdware é in sy et etrre l v nDeze nbestaan ntraaan ota mmeerp vann lo he o meerp n soft essce lg n- tie I” w ééne eb u aalde het orlto aagrin epa aspro roject opboarintm e Ptradk ject vo ware die. bod gekomenof w progra opeepnarova taak o it op ntijk ramre eerder den nin fietn o mmere ce s d rn is s n m sa a n . a in p ta t a D m m m ti ’s g e h maal st ru c tu agnetr elijk st en éé n van g aan b esscentr maat o re n I” on- of eunde n bepa ze bestaan u tot ehtet contr eïnte a. D ij ntwikke Pra oleren it op , le u wasp op de vaalde ta erde itsydeedle vacu rsu lde hkatijktogere uitvoere gramm kken ak op terpreta n t d it ro rdwarepasssy emen na hest “pIn instgest n: van a’s tot d ti e m ro e e m a g l a ra ti a o l én va he n od mmeeerp I” w van loo he warep maat bva pbande Ditt ddoeoerll open micso roject aarin re n h e t t controlere roftco n gdekomen n nsy eoogt cent h instfitne van hva n agntrolledrieensa mijen eé opd rais. t.Dezebb et het rea erz ndestroneemssocentra eat ndpmero rzgijra Een de ds enén bech st a lis a Praktijk m p vo . e o n o m re een p or u aalde erm n van w erp efnro act op sp g sse dje toepas microcontr maabt ruva e de taa midditelop n e haro ra rd e nod bg oller epro ntud sning ewo am Scheme en geïntegre pedra ’s tot ohpdrakchot patifmaava oncsht. gtm -ca a o nerz hm gra omErienng ore derzijd le erd progra te st ijdm na tnre enlie s mean. e co ednodoer fy etpore Dit de s te m se n mmeerb vo m tr o va e rm e le n nva n asso n op d el van brug tu en de re siided m d n are it k n e sy rtiment w e st h e l eneeg ere ardware het pro ssen de Ee va opdrac systeem m ld n . e se Sc e S ïn n n a h te o m ht af te em -compo de apbst gre ra me ns nom enere go op ma prograg rdalisere soren rog nenten rara stemme at van mmm microco ctm a erp tajectriendgeenp em dro n zij d weeererb eg van fyra n asso ntrolle de o.pd daro structbuere ldare simm e van he oo rtiment r e rabcehla jl,ld doo dit systeem. n gtenhetekeeewrsetire anderz t Schem t.ng se rd Eri re e a S ds en ijds vo Eneenrzgijo e n n lg a a a njk.doMor soren men re e de ch oritm liseere t a o rmen d ede pero b e n n st n n tw a brug tu e ra m liseren er idnd mra oicprodco bliva cteerp n jf e hard t e e g o w e e l ssen de datast e g n o e z va n , o o n re ij de eva k vo p den Sc geoïn ware-c mmeetr enn vera odra inh ere obns omructure progra r tedgitreeld zhett eave me h jl,r cd n enomponerstille nt pbro mma. oordf te derd elangri nctust ord heom gera el va et Snctw algoritm ep nten va emtemko e e keuze rin rkmtemere htele jkgende Insi ontweenrt erb en blin ditasy ass ko ekideuew van keanre -e n het proje m microco . Meefy o r dniv rp in rt jf im g st le t e e o e e e re ct uite n n e n eenanlle ook vom. Sa ntroller waa g, de crld t se eaetinvid o p Een go e sl n n rmate a so m te m g ve in o capacite rdoor d r dit en reali zet eve are hereneit rantw arnin d abijstra ede pro t h o d e it van se n e o e ct eel va ren z ze opd tuele te beperkte sa rde ke verf. datastru va g w m ra e a e re rd ij m ra n de n te ko u ld Individ meersti ighede ze van he de rtkomch rekestneva ct llenn hva tgeen u n op e uele jl, do -e etn t mproject uit en allneieke ka belang uren ewn alg en luin acht o sy en maans biend opSslchahegetca dieke e steem ermate rijk. M aardoooritmecrneativoitrd e it p m n b r a t tw a e w ij ci o in r nier in er microco ordt blijf t o h e e in he teit va de prade vemrfd g, deze o ntroller vaanrdoig pd chok voeot sarp m en t afgelo n daeangemoed ktijk to. t ee u r dit ensteelleenn ve zet eve heddeen in h nra igd, pen jaa e te pa n ke ka n nhtw deel va vara ntuele opeere bepen rde ke en tlud r verwo ssen. etoosy rkte iere tekortko n n st s ie u Individ e rven z b ke van mingen manier kinen -eniedt oh uele cr rojectem weord metdepin t aang alleen d eativite o u e p it h p waardo e sl e ra e rmate t afgelo agca moedig maar in ktijk to it bij or dez pen jaa d, het sa de verf e tepapciate e opdra vaardig r verwo ssiten.van d menste . e cht een heden rven llen va unieke op een n h et syst kans b ludieke eem w ied manier Onders ordt a in de p t om de in he teunin angem raktijk g oedigd toe te p t afgelopen ja , ar verw a ss e In de n. orven practic a van prototy het va pische k “Inte sensore microco rpretati n verd ntroller e I” w uide verbind ordt ko en en w lijkt, wat vo rt de o elke Sc werkin heme-p r elektrische g van rocedu enkele res sen schakelingen sorwaa d rden uit eze met de lezen.
Introdu
ctie Waar het
Now you might think that all of the students’ energy went into the creative part (boxes, teddy bears and punching bags), but each year the code that was handed in was also of a very high quality. Because of the limited computational abilities of the microcontroller, suboptimal implementations or algorithmic choices become apparent immediately. For the Tamagotchi project, most students came up with clean finite state machine designs. For the rhythm game projct, some students even structured their game around event streams: only when the next element in the stream is required, a new sensor reading is made. Students that were particularly interested in the hardware side of the project, incorporated interrupt handlers in their code or ensured their game launches by itself as soon as the controller is powered on.
UbiLab@soft: λ on Engineerin Faculty of
g
4 μ
master thesis ons i t c a r t s b A ency r r u c n o C g d n e i d t d n e e b m e m l E p Im -Core i t l u M g n i m for Program me e h c S n i s m Syste e ent of the uter Scienc rtial fulfillm ring: Applied Comp a p in d te e bmit r of Engine n thesis su e of Maste re Graduatio g e d e th ts for requiremen
mme a d n a V n e b Ru
eu t er gan g D e M lf o W . r D Prof. over Pr om ot or : oen De Ro C . r D : s r Adviso Scholliers Christophe
We have already had the high school students, the first bachelor students .. this only leaves some of our teaching activities in the master. I’d like to quickly walk you through a thesis from one of last year’s master students. What he did was port a Scheme interpreter to a multi-core embedded system.
UbiLab@soft: λ on
4 μ
master thesis about multi-core carrots
μ4-controller 4 cores 64KB RAM / core 4 hardware threads @ 400Mhz convenient package can be linked together already used to implement hardware in software Yes, you heard me right. Apparently, there will even be multi-core carrots in future microwave ovens. The one that we used (an XMOS XC-1) has 4 cores each capable of running several threads. The nice thing about this chip is that it provides hard guarantees about the speed at which each thread will be executed. This allows you to implement timing-sensitive tasks in software rather than in hardware. One of those timing-sensitive tasks is, for instance, the serial communication protocol in which the right bit has to be put on the wire at the right time.
UbiLab@soft: λ on
4 μ
master thesis about multi-core carrots
PWM
UART TX
logic
UART RX
!"#$%&'
logic
UART TX
()$$(*+
*%,-()
PWM
./(01
UART RX
For his thesis, the student ported a Scheme interpreter to the multi-core embedded system. In this example from his thesis, there is a Scheme process running on each of the cores of the microcontroller. One of them takes care of application logic. This application logic comprises changing the color of a LED when a button is pressed. The LED’s color is altered by changing the width of each pulse in a rapid succession of pulses that are delivered to the LED. This process is called pulse width modulation: a way to deliver energy through a rapid succession of (digital) pulses rather than a continous (analog) signal. In this example, the pulse with modulation is implemented by a Scheme process that runs on a different core and communicates with the application logic through message passing. Precise software control over these pulses is only possible because of the timings that are guaranteed by the microcontroller. The same goes for the serial communication protocol through which two Scheme processes on different multi-core microcontrollers can communicate wirelessly. The next movie shows how this functionality is used to alter the color of a LED on another microcontroller than the one on which the buttons are pressed.
awar
ded
Usually, microcontrollers implement the functionality related to serial communication (UART TX and UART RX) or pulse width modulation (PWM) in hardware. However, this approach requires such dedicated hardware to synchronize with the application logic. For instance, through interrupts. Unfortunately, interrupts are a frequent source of bugs (stack overflows, interrupt overloads, etc..). The student’s thesis demonstrates that it is feasible to implement such functionality in software instead. More precisely, as fully garbage-collected and interpreted Scheme (!) processes that communicate through message passing.
Yves e h c s s e i r Vand
Christophe Scholliers
Coen De Roov er Finally, none of the aforementioned teaching activities related to ubiquitous computing at the SOFT Lab could have been possible without my partners in crime: Yves Vandriessche and Christophe Scholliers. Thanks guys! And of course, the same goes for the heads of the SOFT lab who were instrumental in introducing the UbiLab hardware in their courses: Theo D’Hondt, Wolfgang De Meuter and Viviane Jonckers.