A small device based on an microcontroller with a square LED array. Attached with a microphone. This project was my first attempt to use AI supported coding. I used claude api. The results were quite sobering:
- claude is very forgetful. I had to repeat my goals very often.
- claude is very expensiv. For this little project I had to pay about $30.
- The code is well documented but very poor structured. It's hard to find the desired function.
- Each node is part of a swarm but also can live alone.
- each node has 3 inputs:
- message from neighbour
- recorded noise from microphone
- randomly generate time slot
- each node has 2 output.
- message to neighbours
- animation on led array
- each node has the following states:
- booting
- dreaming
- following (music, talks)
- panic level 1
- panic level 2
- panic level 3
- each bot has a set preset animations displayed on the led array:
- breathing(frequency, colorset)
- letters(string, color, bgcollor)
- blink(frequency, colorset)
- sparcling(intensity, colorset)
- rotation(frequency, colorset, direction)
- spectrumLevel(bass, midrange, treble)
- Esp32c3 super mini
- ws2812 based 8x8 rgb led array
- INMP441 mems module on i2s
- LiIon 18650 battery / usb-charger
- Framework: ESP-IDF
- Build-System: PlatformIO with
framework = espidf
-
when a node is started it will
- annouce its id via a letters-animation(mac-adress)
- initialize the interrupt driven message recieving routines
- wait 5 seconds
- broadcast a request for rssi via wifi
- all hearing nodes will answer their mac and rssi
- the ids (mac) of the 2 nodes with the highest rssi will become its neighbours (- after a second all other nodes will also perform this procedure to refind their 2 neighbours)
- the microphone will be initialized
- using the mic meassurment the random generator will be seeded
- a random time periode between 2 and 30 minutes will be generated and a timer started
- the main loop is started. Within this the following controll steps are done:
- analyse the sound buffer
-
when a node recieves a request for rssi
- it will send the rssi to the requester
- it will initiate a rssi request to update its own neighbourhood.a request storm / loop must be prevented.
-
when it recieves a panic level message from a neighbour
- it will set the panic level flag
- starts a delay panic timer. the panic animation should start with a delay of 200ms to achieve the effect of a color change wave in the swarm.
- it will forward the panic level message to other neighbour (not the sender).
-
when a random timer message is recieved:
- the ramdom animation should start at once.
-
when the sound analyser routine detects:
- "silense" for at least 1 minute the breathing animation is started
- "talking" the rotation anmation is started
- "music" the spectrumLevel animation ist started
- "hand claps":
- the blink animation is started
- a panic level 1 message is send to the 2 neighbours
- the level animation should be held for 10 seconds
- "screaming":
- the blink animation is started with other values
- a panic level 2 message is send to the 2 neighbours
- "thunder":
- the blink animation is started with other values
- a panic level 3 message is send to the 2 neighbours
- the level animation should be held for 2 seconds
-
when the random timer is fired: - the blink animation is started with other values - a new random time is generated and the timer set - the random message is broadcasted to the swarm

