This tutorial will show you how to use a light sensor to tell an automatic pet feeder that the food bowl needs to be refilled. Basically, the light sensor is at the bottom of the food bowl and when the light sensor detects light that means there is not enough food on top of it -- thus triggering a refill.
Step 1: Complete the Building an Automated Pet Feeder tutorial
The Building an Automated Pet Feeder tutorial will guide you through the process of building the food dispenser itself (not using a light sensor yet). This tutorial can then be extended to be used in several different pet feeder projects. Once you have completed that tutorial, you can come back here to learn how to use the micro:bit's light sensor and connect it with the basic pet dispensing code.
Step 2: Learning to use the micro:bit light sensor
The micro:bit's 5x5 LED board doubles as a light sensor and its value can be accessed by the light level block found in the Input block category. Its value can range from 0 (darkest) to 255 (brightest).
If you'd like to do some testing to see what value the light sensor has when you expose it to different amounts of light you can have the micro:bit constantly print out its light value to the screen using the below code:
You'll also want to test it out by putting it in the bottom of a food bowl and seeing what its light level is when the bowl is full compared to when it is running out of food.
I decided that 10 was a good threshold for my light sensor. When the bowl was full enough the light sensor's value was around 5-7, and when it started to get exposed to the light and it felt like an appropriate time for a refill the sensor would get above 10. You might decide you want a higher value to use as your threshold if you want less frequent refills than I did.
Step 3: Connect the automated pet feeder code to the light sensor code
As I mentioned in step 2 I decided to use 10 as my threshold to decide whether or not to refill the bowl. If the light sensor value was getting a reading below 10 then that means there is enough food (because the food is blocking the LEDs from the light), and when the light sensor was over 10 that the bowl needed a refill. So I wrote a program that constantly checks the light levels and if it is >= 10 to move the servo to 90 degrees and dispense more food. Otherwise, it would keep the food bottle shut.
Located in the second basement of the ATLAS building on the CU Boulder campus, the immersive E.coli cell has begun to form. This is a project Annie and myself (Lila) are working on in the lab. We are working on building an immersive experience where the visitor can enter into and manipulate an E.coli cell. We imagine a space where the user transcribes DNA to RNA, then runs that through a ribosome to activate a protein which then can be used in a specific receptor that have different effects on the cell. For example, perhaps one protein will cause the cell walls change their shape, texture or color, where perhaps another protein will send a message to nearby cells which can be viewed through a portal window.
While much of this still needs to be built, we have constructed the majority of the DNA and the type of user interaction that will occur. There are kinks to work out but the video below shows and describes the plan for the cell and DNA.
Below is also a video showing the fabrication of the DNA and the framing of the room.
Since the completion of the 10 yeast cells - based on different mutants and environmental conditions as studied by Zach Wilson - they have been on tour. Their first stop was Molecular, Cellular, Developmental Biology department retreat where students show their current work during two nights of poster presentation. When the yeast cells made their debut they received a high amount of attention from other graduate students curious about the visual forms and the science behind them. Some viewers stayed for 30 min trying to puzzle their way through the science and what each piece of data was telling them - much like Zach's own research process.
The cells second stop was a joint lab meeting (photo above) where Zach featured the yeast cells as a part of his talk about his research progress. He used them as a way to facilitate conversation amongst the labs and encourage group members to try to recreate a circuit diagram that described interactions between the a vacuole membrane lipid (PI3,5P2), a vacuole ion channel and pump, which helped to understand the lipid's function to regulate the cells water and ion concentrations.
The third stop on the yeast cell tour was the Annual Rocky Mountain Yeast Meeting held at the Coors Brewery. This time we tried a different set-up where the lanterns were hung on the wall instead of splayed out on a table. In part this was to match the format and spacing of the poster presentation. People's interest was peaked by the different display of information and many people stayed to investigate the lanterns and try to once again work through the science to see if they would come to a similar conclusion as Zach.
At the Yeast Meeting event there were several suggestions and questions we encountered which led to some slight redesign of the lantern lighting. For example, Zach's advisor suggested that we time the rates to all start together so that you could compare which rates were longest and shortest. Using the micro:bit radio function this was an easy fix. We also experimented with different color ranges to show high and low potassium concentration rather than brightness. We found viewers had a hard time distinguishing between higher and lower potassium concentrations. We implemented these changes and then submitted the yeast cells for a campus wide data visualization contest that the Norlin Library was putting on.
The Luminous Yeast project received second place in the campus wide competition and are currently residing in the 2nd floor of the Norlin Library (as shown above). Patrons of the library are instructed to peer inside and try to figure out the story of Zach's research - and to see what conclusions they arrive at. You can see an article about the competition here.
These are the costume sketches. AS you might notice, there are some fairly significant changes in certain outfits between what I sketched and what I will be creating as of this moment. There are also a few costumes missing; mainly the Blues and Hip Hop dancers. For these costumes, I already had a pretty clear idea of what I wanted them to look like, and functionality wasn't as much of a problem as it was for dancers. For example, with the aerialist, I had to think of both how to expose the areas in contact with the trapeze most (so no electronics are there), while also making the costume work for more hip focused styles.
These are the costumes from the sketches above. Each design choice has an explanation in the chart below. The yellow dots are LEDs. (;
Story Planning / Explanations
Physical World Progress
So far, I have done a lot of ordering of stuff. I also made a skirt! I wanted to test a new technique, specifically for the swing dancer costume, but also for future pieces, of creating mesh piping to sew around hems that encase neopixels. Since this is a costume rather than an everyday garment, the LEDs don't need to be quite as obtrusively hidden. In the mesh, they are partially, but not entirely hidden from view.
THe other part about the real world progress is that I am trying not to sew as many of the garments by hand this time. Some costumes will be mostly hand sewn, but I am trying to find better ways to incorporate electronics into ready-made clothes.
This code is supposed to use two Microbits, communicating with radio singles, light neopixels based on their proximity. Right now, this is technically working but will require more fiddling before it is exactly what I want it to be. The signal readings that the brightness respond to are a little in consistent, and I am trying to make the whole thing more smooth.
For this one, at this point, this is just test code. I was tiring to get the compass to work, and it doesn't work all that well, to fill bars on the MicroBit based on where you are facing when turning in a circle. It didn't work, but after more fiddling, we learned that it is because the Microbit's compass readings are about 30 degrees off in random directions for no apparent reason. We (Kari and I) used an iPhone compass pointing in the same direction as the Microbit, and the Microbit was consistently off.
On my personal blog, I post weekly updating my progress, click here for the link.
Emily Daub wrote this article. Emily Daub is an undergraduate research assistant in the LPC. She also received an Undergraduate Research Opportunity grant from the University of Colorado at Boulder and is mentored by Ben Shapiro.
Since early January, Zach Wilson and Lila Finch have been collaborating to think about new ways of communicating with and about science. Zach is a sixth year PhD student in the Molecular, Cellular, and Developmental Biology (MCDB) program and Lila is a second year PhD student in the ATLAS program and a member of the LPC. Zach studies a lipid, called PI(3,5)P2, in the vacuoles of yeast cells. His research is focused on how this lipid controls ion transport at vacuoles to regulate the size, function, and water levels in vacuoles. While his research is performed in yeast, he is currently connecting his discoveries to how plants react to environmental stresses, like high salinity in the soil.
The work together has been about finding new ways to tell the story of Zach's data in ways that have the potential to create new conversations and produce new interactions between the scientist and audience. Through the process of designing and making the artistic representations of the science story, Zach and Lila are examining how knowledge sharing between the two occurs, how it pushes each of them to think about their work in new ways and/or communicate with colleagues, and are curious how the work is used/discussed in different settings (e.g. a scientific poster conference vs. an art gallery vs. a museum space). Below is a little cartoon of the process Zach and Lila went through to arrive at a new representation.
Zach and Lila decided the representational form should be lanterns with which the audience could interact with to make discoveries on their own, whether Zach was there to explain or not. They wanted to have the representations be based in data collected by Zach, so that he could tell the same story he normally does, but in the hopes that the audience would lead themselves through that story by asking him questions. They decided to place a viewing hole in each lantern where a viewer could peer inside of the lantern to get a feel for the types of data that Zach sees and draw conclusions about the relationships between the lights and size; almost being able to explore the correlations Zach has found, without necessarily knowing the meaning. Zach and Lila wanted the lanterns to be able to be used in different contexts, for a scientific presentation or in an art gallery or museum space - where without the context that these are wild type and mutant yeast cells, a viewer could still spend time imagining a story this representation tells.
After deciding on lanterns as the representational form to try out, Lila and Zach have been constructing lanterns that are based in the data Zach has collected for his dissertation. To begin they wanted to make one lantern showing a cell with a vacuole inside that would be able to expand and contract based on different conditions or show different mutant variations. However, because they also wanted the audience to be able to see inside the cell and for there to be multiple cells for more audience members to interact with, they settled on the idea to create one lantern for every mutant Zach has found important to his story, and wild type cells under different conditions. Because the initial idea was to have the lantern expand they settled on latex as the medium to cover the lanterns. Here are some images of a first trial lantern and the process.
Both Zach and Lila felt the latex did not provide any additional purpose besides feeling a bit like skin and did not hold together well, so they decided to instead cover the lanterns in paper, a medium Lila is more familiar with. Below are images of the next trial with paper which they decided was better. The images are from two almost complete lanterns.
These lanterns represent several aspects of Zach's data - including cell size (external size), vacuole size (internal object size), vacuole numbers (nubs on internal structure), lipid number (orange lights), potassium levels in the cell (blue lights), and growth rate (speed of movement of white lights). Each lantern uses a micro:bit to drive the lights. The video below shows the lanterns in a little more detail and the movement of white light indicating growth rate.
Not only do these two lanterns in the video still need to be painted on the outside, when complete there should be a total of 10 lanterns. Only eight more to go!
This past spring semester, for Danielle Szafir's Information Visualization final project, our group decided to make a data physicalization of world happiness data. This interactive sculpture visualized and allowed viewers to explore data from the 2016 World Happiness Report, which ranked 156 countries by their happiness. Happiness scores were determined by surveys collected about individual's life satisfaction in relation to other factors such as health and income.
We decided to use a somewhat traditional form of an ordered bar graph to indicate the overall happiness score for each represented country. The interactivity came by selecting or de-selecting regions of the world (by pressing that region) and in doing so activating or deactivating the lights for those countries. In that way a viewer could narrow down the region of the world they were most interested in by deselecting other regions of the world. Additionally, factors affecting a countries happiness could be examined by pressing attribute buttons for GDP per capita, family, life expectancy, freedom, government trust, or generosity. When the attribute factors were pressed (only one could be selected at a time) then the map showed a color scale of high (orange) to low (blue) for that countries ranking of that attribute. The video below shows how this visualization could be used.
It was an all hands on deck type of project using all of our skills and talents to pull together such a large artifact! The project consisted of over 300 individually addressable LEDs and 18 micro:bit microcontrollers, along with a massive 4'x8' sheet of particle board with a CNC engraved and cut map of the world. Every bar for each country was individually cut, had lights glued inside and was papered over the outside with a label so it would glow when selected. Here are some pictures of our process.
The project went through many rounds of design before we settled on the map and bar structure - from human sized bars you could crawl on to a game of sliders where you physically moved the happiness bars of each country until you got them all correct. But even once the format was decided upon, programming the LEDs and getting the interactivity went through several iterations. The video below shows the programming structure of how the buttons worked in the final format, however at this point we thought we were going to use brightness for the amount of each attribute and color for the different attributes. We found (as you will see in the video) that the brightness was too hard for our eyes to distinguish, so we went with a color scale in the final product. This video does show how the 18 devices communicated and interacted with one another.
The group consisted of Matilda Whitemore, Ben Galassi, Daniel Frost, Adam Siefkas, and Lila Finch. In the time lapse video below you can see us working through the night and into the morning to get the table constructed.
Although the map had a long life in the ATLAS lobby, it has just been deconstructed and its parts cannibalized to be reused in new projects!
This week Emily and Lila chose the aesthetic theme of squares. Again one person designed the outline of the puzzle, while the other designed the pieces of the puzzle. Then both, using the puzzle design and aesthetic choice, collected data that was inspired by squares. Here are the creations from week two.
This week Emily....
Lila on the other hand used a different technique of data collection and self-reflection to make her puzzle. Inspired by squares, she chose to use the number of right and left turns from a single day, between leaving for work and arriving back home. Instead of taking physical notes, she used it as a mindfulness activity, mentally remembering the paths she walked. Then the following day she mentally retraced her steps noting all the right and left turns both walking and driving. She then translated that into squares where three of the same type of turn created a square (arriving back at the original location but facing a different direction). An icon in the center of each square showed the specific path to and from: work, advisor's office, bathroom, Lowes, around the office, post office.
Now that two weeks work of puzzles are complete the puzzles are starting to expand and fit together to make a larger puzzle! Fun to see this taking form!
Your update from the LPC this week is the announcement of a new project by Lila and Emily that incorporates the laser cutter, data collection, and puzzles. The project inspiration came out of a project already started by Lila, a Ph.D student in the ATLAS Technology, Arts and Media program, and a colleague in a different state. In the project, they decide on a location for which they collect data, and then use their individual creativity to manifest that data in a sewn quilt square. The puzzle project that it inspired, turns this model on its head. Lila and Emily decided to make one puzzle a week (each of which fit together) for the rest of the summer to ultimately end up with one large puzzle. The puzzle would be created based on an aesthetic key chosen, such as spirals, rectangles, or lines, and then find data that could be represented well by that aesthetic key and design the puzzle using the aesthetic key.
In the system decided by Lila and Emily, the first step is choosing the week's aesthetic key. Then, one person would create the outside shape of the puzzle, and pass the file to the other person, then that person would create the puzzle pieces and send it to the first person. Then, each person designs what will go on the puzzle pieces without showing or consulting the other in it is represented past the aesthetic key given at the beginning of the week. Both puzzles then get laser cut and presented, and that is the end of the week!
For the first week, the aesthetic key was "spirals" - and Lila and Emily collected data relating to the the aesthetic of spirals. Lila's representation of spirals, began with thinking about driving as spiraling in towards a location, specifically going home and to work. She tracked the presses and releases of the gas, brake, and neither pedal as she drove to (light line) and from work (dark line) and transferred the length of time of each of those presses into spirals (up spiral = gas pedal, down spiral = brake pedal, flat line = neither).
Emily's representation was quite different. She took accelerometer data collected with a Micro:Bit while doing flips on a trampoline. She then graphed the accelerometer data in an app, and then rastered (a method of "printing" using a laser cutter) the graph on the puzzle, also with other statistic she gathered with her smart watch, such as the time spent jumping and calories burned.
This past weekend we ran our first workshop making lanterns at the STEAM Fest Family Fun day, put on by the CU Museum of Natural History. The families, a parent and a child, worked to construct a wire and paper lantern (pyramid or cube structures), decorate it, and program LEDs to illuminate the lantern.
During the two 1.5 hr sessions we had ~15 pairs participate. The children were ages 6-13. It was wonderful to see the parent and child work together to design and construct their own unique physical lanterns. Most families created some kind of story with their painting on the outside. One girl painted her and her grandma on the top showing that they were the two making this lantern. Another child took a story she had written about the adventures of four superhero dogs during a different STEAM session earlier in the day, with Myra Makes, and painted images from that onto her lantern.
For nearly all of the participants, the children especially, this was their first experience with programming. Given that we had a very limited time we introduced the micro:bit and some basic blocks for programing the lights. It was fun to see what different LED light patterns the families wanted to try out to illuminate their lantern, such as a rotating rainbow or flashing red lights.
Overall, it was a great workshop and all families took home an individualized lantern. In future workshops we hope to have more work time with the families so we can include data collection and visualization with sensors, thinking about how devices can communicate, and how information from the natural sciences can be investigated with these lantern forms.
The lantern is complete and runs with data!
This was no small task getting the final parts of the lantern functioning properly. The last steps were to collect the data from the garden, query it, and then program the lights to respond to the data. Ben wrote a wonderful database so that now we can collect data from the garden, store it, and query it! Once that was complete we needed to hook up the lights. However, in order to run the database querying we could only light 216 lights, but the tree has 229 nights! Therefore, we had to learn how to use a Arduino mini to run the lights as a "backpack" from the Arduino uno. This was quite complicated, but with help from ajfisher (at about 1am!) we were able to get the mini programmed and the uno directing traffic to the mini. Here is what that looked like!
Finally, the lights were ready to go and could connect to the data. However, the task of deciding how to map the data to the lights and then program that was no small task. I decided to draw on what high school and middle school students would learn about plants. So after reading standards, textbooks, and thinking back to my own studies, I decided to focus on the processes occurring in plants, such as photosynthesis and transpiration. Here is what the final tree looked like from the front and back!
The lights you see moving in this data show real time data! I took the moisture, temperature, and humidity values and determined how "fast" and how much transpiration, visualized with teal light, would move up the tree (can be seen below). So if no water is present and the plants dry out then no movement happens with those lights, and the overall blue on the base fades to red.
As for the photosynthesis it occurs on the "leaves" (of course!) which I imagine are like the little nubs on the branches. So you can see when the light level sensor detects enough light then photosynthesis can occur. Temperature and moisture also play a role in this to affect speed. So if you watch one of the nubs in the next video you can see it turn from white to yellow and then fade to red before being "transported" into the tree's branch. This is like the sugars being made and processed from glucose to sucrose and then be transported around the tree to other parts that are not able to do photosynthesis.
And finally the overall health of the plan can be determined by looking at the face of the "garden spirit". As moisture drops and stays dropped the blue drains out of the face leaving it more red. However, if the plant is also unable to do photosynthesis for a while (no lights is being detected in the garden and/or temperature is too low) then the red also fades out of the face. Therefore, if the plant has little water and little light then the face lights go very dim, showing an unhealthy situation; however if the plant is healthy we should see a nice purple glow! Here are some final pictures of the lantern with data!
What a wonderful project this has been! Thank you to everyone who has helped with this project!!! Sad to see it be almost finished up, but excited to get into classrooms and working with students to design their own garden lanterns!