Talks

Summarized using AI

Programming in the Small: Kids, Chickens, and Ruby

Coraline Clark and Jason Clark • November 10, 2016 • Cincinnati, OH

The presentation "Programming in the Small: Kids, Chickens, and Ruby" by Jason and Coraline Clark at RubyConf 2016 discusses a father-daughter project aimed at solving a real-world problem associated with their backyard chickens. After years of programming together using the Ruby Shoes GUI library, they decided to build a chicken monitoring system to track egg production, given their eleven chickens and the difficulty in identifying which chicken laid which egg.

Key points covered include:

- Introduction: The presenters share their programming background with Ruby, and their pet guinea pig named Ruby illustrates their love for programming in the Clark household.

- Identifying the Problem: The challenge of keeping track of their chickens and the eggs is highlighted, especially given the indistinguishable appearance of the eggs laid by different breeds.

- Solution: The Clarks created a Raspberry Pi camera system to capture images that would help track egg production. They explained the system's architecture involving hardware like the Raspberry Pi and software components built using Ruby.

- Tips for Engaging with Kids: Jason shares valuable advice for working with children, such as breaking down projects into manageable tasks, allowing kids to take control, and focusing on hands-on, visual programming experiences.

- Programming Process: The presentation covers their programming approach, including connecting the Raspberry Pi to a display, using terminal commands, and developing a desktop application using Shoes.

- Demo: They present a demo showing how the camera system works in real time by capturing images of the chickens in their coop. They also discuss future enhancements, including better lighting, improved date selection for egg-laying tracking, and the idea of automating the coop door.

Conclusions and Takeaways: The presenters emphasize the joy of bonding through programming with children while sharing practical insights on implementing tech projects. They express hopes for continuing to engage children in technology and making meaningful projects that address real-life problems while enjoying the creative process of programming together.

Programming in the Small: Kids, Chickens, and Ruby
Coraline Clark and Jason Clark • November 10, 2016 • Cincinnati, OH

RubyConf 2016 - Programming in the Small: Kids, Chickens, and Ruby by Coraline Clark & Jason Clark

After several years of programming in Ruby using Shoes, my daughter and I were hunting for a new project. Something more useful than a game. Something with a real-world connection. Then it struck us: Chickens!

Join us as we show you how we built our coop monitoring system. It’ll be a wild ride of hardware hacking, weather-proofing, and father-daughter bonding, with Ruby sprinkled throughout. You’ll learn how to modernize your surroundings, and about engaging the young people in your life in technology along the way.

RubyConf 2016

00:00:14.280 Welcome everybody to our presentation on Programming in the Small: Kids, Chickens, and Ruby. I'm Jason Clark, and I work as a software architect at New Relic.
00:00:19.800 And this is your opportunity to introduce yourself.
00:00:27.360 Hi, I'm Korra. We're so glad that you're here today!
00:00:35.010 A few years ago, Korra and I did a presentation at Cascadia Ruby, which was about Shoes programming. Shoes is a GUI library, and we will see a little bit more about it later.
00:00:48.539 Together, we had created a series of different programs using Shoes. Can you tell us about some of the things we made, Korra?
00:01:01.980 We made a Star Wars program!
00:01:09.240 That's right! What did the Star Wars program do?
00:01:18.439 Well, when we pressed 'D', Darth Vader's lightsaber lit up.
00:01:25.759 And when we pressed 'Y', Yoda's ears went down.
00:01:31.579 And when we pressed 'L', Princess Leia's lightsaber came up.
00:01:43.880 That's right! And I found a bug that my dad didn’t notice. If we pressed 'D' too many times, Darth Vader's lightsaber went off the screen.
00:01:52.140 Yep, she was my tester! This was just one example of the many programs we created together, and we had a really good time.
00:02:00.289 We love Ruby in our household, don't we?
00:02:13.140 Ruby is pretty awesome! How much do we love Ruby?
00:02:18.180 A lot!
00:02:24.599 So who's this on the screen? This is Mike, our pet guinea pig.
00:02:30.850 That's right! We like Ruby so much in the Clark household that we named our guinea pig Ruby.
00:02:37.510 After enjoying our programming and games, we wanted to take things to the next level. We wanted to solve a real-world problem in our lives.
00:02:50.200 What was our problem, Korra?
00:02:57.970 Our chickens weren't laying eggs!
00:03:04.570 That's right! We have chickens in our backyard. We are from Portland, Oregon, so of course, we would have chickens.
00:03:11.200 Keeping track of the chickens and the eggs they lay is a real challenge for us.
00:03:16.390 Can you explain why this is such a problem, Korra?
00:03:22.120 We have two identical ones.
00:03:31.420 We have eleven chickens.
00:03:38.500 Now, if the city of Portland asks, 'Is eleven a lot?'—well, eleven chickens is a lot to keep track of!
00:03:45.459 A big part of the trouble is that, as you may know, chickens lay eggs that look very similar.
00:03:51.580 We have a couple of Ameraucana chickens that lay kind of blue-green eggs, one that lays white eggs, and the rest lay brown eggs.
00:03:59.260 We can't tell the difference between the vast majority of these chickens and what eggs they lay.
00:04:05.440 The Polish doesn't lay eggs very often.
00:04:12.610 That's right! We'll see a picture of her in a few minutes. She's pretty small and doesn't lay often.
00:04:18.310 But we can tell when she does!
00:04:24.220 Another issue is that the chickens lay eggs at different rates, depending on their age and the time of year.
00:04:31.120 During certain times, they may lay eggs every day, or every two to three days, or they may hold out for much longer.
00:04:36.409 This isn't ideal, especially as winter sets in.
00:04:41.539 They all tend to slow down considerably.
00:04:47.449 So, let's give them a little introduction to some of our flock.
00:04:53.059 This is Cuckoo Maran. My brother and I named her Blackie because she's black.
00:05:01.309 Alright, let's move to the next one.
00:05:06.709 These are a pair of our Ameraucana chickens.
00:05:12.709 Yeah, that's what Mom said. One is an Americana, and the one at the back...
00:05:17.929 is the kind that I forgot.
00:05:23.329 Well, she might...
00:05:28.610 Okay, Mom is confirming she may actually be correct about this.
00:05:34.219 This is why it's great to co-present!
00:05:39.379 Alright, the next one. This is one of our Turkens.
00:05:46.459 They aren't actually related to turkeys, but you can understand where the name comes from.
00:05:51.499 Yeah, that's our oldest one. It's among our older ones. We got them from some friends after there had been a little coyote incident.
00:05:58.119 People would come over and we'd say, 'These are the chickens we adopted because they got attacked by coyotes.'
00:06:04.089 And they would respond with, 'Oh, that's so terrible! When will her feathers grow back?'
00:06:09.619 But that is just what turkens look like—it was not related to the injuries at all!
00:06:19.219 Okay, next we have I think three Red Sexlinks.
00:06:25.099 Because when they lay eggs, they're brown.
00:06:31.969 This is our Polish chicken, the one chicken we have that is actually named. Her name is Rockette.
00:06:39.499 She had a little incident early in her life, and we ended up nursing her back to health.
00:06:45.949 My brother tried to pet her with a stick, which almost killed her!
00:06:53.720 Life's rough as a chicken!
00:06:59.450 So, this is a bit of what we're dealing with. We've got so many chickens and different things to keep track of.
00:07:05.120 So what was our solution? What did we come up with to figure out how to keep track of the chickens?
00:07:11.780 We made a Raspberry Pi camera!
00:07:17.780 Okay, why don't you step forward and we can show them our system diagram.
00:07:24.140 You took care of the artwork! So, what happens in the first stage?
00:07:30.120 A chicken lays an egg.
00:07:36.170 And then what happens above it?
00:07:42.230 The Raspberry Pi takes a picture.
00:07:47.300 And then where does the picture get sent to?
00:07:53.750 Amazon! That's right. We send our chicken pictures to the cloud.
00:08:00.230 It's great working with modern architectures; it makes development so easy.
00:08:05.600 Then it shows this on Shoes.
00:08:11.180 So then we wrote a little desktop app to view this data. This was a fun project to put together.
00:08:17.780 There were many different stages to it, which brings us to the first tip I have for working with kids.
00:08:24.740 When you're working on projects with your kids, it's important to break things into small, digestible pieces.
00:08:31.070 The attention span of an eight-year-old is not the same as that of an adult. As kids get older, their attention spans typically improve.
00:08:41.660 You need to know how much time you can spend with them, and plan accordingly.
00:08:48.140 You don't want to overwhelm them or bore them with long sessions.
00:08:55.220 It's important to keep it light and fun.
00:09:02.310 So, Korra, what's your first takeaway?
00:09:07.890 It's fun to spend time with Dad!
00:09:15.170 And I totally agree! Building things together with kids is a fun way to connect.
00:09:20.310 It links the work we do as developers with their interests and helps teach them valuable skills.
00:09:27.890 Our first big section that we're going to discuss is hardware. So, what is hardware, Korra?
00:09:37.170 Stuff you get at Home Depot!
00:09:43.160 I love it! That's technically accurate but not exactly what we're talking about.
00:09:48.200 What kind of hardware are we really discussing?
00:09:54.000 We're talking about computers!
00:09:59.100 That's right! We're inside the computers.
00:10:01.260 What we've got up here on screen is a partial shot of our Raspberry Pi.
00:10:07.140 It's just a little teeny tiny computer—about the size of a card.
00:10:14.370 This brings us to our next dad tip.
00:10:20.160 As you're doing these projects, it's great to explore with your kids, but it's also valuable to try some things out yourself ahead of time.
00:10:26.280 For me, I had never worked with a Raspberry Pi before this project, so I spent some time debugging it.
00:10:32.010 I wanted to make sure everything would run smoothly when Korra and I started working together.
00:10:39.210 It's great to do as much as you can with the kid while avoiding roadblocks.
00:10:46.320 So, what's in this picture, Korra?
00:10:53.010 The Raspberry Pi with the camera attached.
00:10:59.990 That's right! The Raspberry Pi does not come with a camera—you have to order it.
00:11:07.430 You also need to get a Wi-Fi card.
00:11:12.460 So we got both the camera attachment and a little Wi-Fi adapter, so the Pi could connect to the network.
00:11:19.150 What step of our process are we on now in building out the hardware?
00:11:27.570 We put a hole in the box to fit the glass part of the Raspberry Pi camera.
00:11:33.430 This way, it can take clear pictures of the chickens and their eggs.
00:11:41.390 Why did we need this plastic box?
00:11:48.080 To prevent the chickens from picking at it.
00:11:55.640 We're placing this outdoors in a chicken coop, so it needs some protection.
00:12:02.200 But we didn't do anything fancy—we just used a plastic box we had and punched a hole in it.
00:12:10.430 So let's look at the completed physical part of the project.
00:12:15.650 We screwed it down to a couple of pieces of wood, and what did we use to prevent it from sliding?
00:12:21.920 Duct tape! Why would we use duct tape in a chicken project?
00:12:29.900 Well, it should have been chicken tape! But I guess it worked out in the end.
00:12:36.080 So here is a picture of our chicken coop with the camera installed.
00:12:43.150 You can see the ladies roosting at nighttime.
00:12:47.060 That's partly why the lighting looks like it does. We have those lights strung up so that during the darker parts of the year, they get a few extra hours of light.
00:12:54.410 This sometimes encourages them to lay eggs more frequently than they otherwise would.
00:13:01.040 I hope those of you into woodworking appreciate the craftsmanship involved in this!
00:13:07.670 You can see the hole where the camera looks through, positioned right over their nesting area.
00:13:14.680 Now, there was some software to go with our hardware. What software did we write?
00:13:22.040 We wrote all sorts of software! It's the instructions we give the computer.
00:13:27.050 If the Raspberry Pi is just a small device, how do we program it?
00:13:32.839 We plug it into a big screen because the Raspberry Pi does not have a built-in display.
00:13:42.949 Thankfully, Raspberry Pi has an HDMI output, allowing us to connect it to our TV.
00:13:50.180 We were also able to plug in a USB keyboard to get programming!
00:13:57.319 So what was the first thing we did when we booted up the Raspberry Pi?
00:14:04.699 Raspberry Pi will, by default, run a basic desktop Linux environment called Raspbian.
00:14:10.250 We did quite a bit of work in the terminal. What command were we using?
00:14:15.889 What do you want? 'LS'!
00:14:22.610 Anytime Korra sees a terminal, she wants to type 'LS'.
00:14:27.639 And what does 'LS' do?
00:14:33.110 It shows us the files!
00:14:39.019 This leads me to my next dad tip. Korra really enjoyed working in the terminal.
00:14:46.910 Learning these basic commands was empowering for her.
00:14:53.510 She could tell the computer what to do and received immediate feedback.
00:15:06.050 While there are powerful programming tools for kids, giving them real developer tools can lead to a great experience.
00:15:12.949 What’s your tip around this, though, Korra?
00:15:19.220 Be careful; otherwise, the program won't run!
00:15:24.470 Computers are really picky! One letter off and things won't work.
00:15:30.889 Initially, I wrote our 'rb' all in uppercase, and my dad corrected me. 'No, no, it should be lowercase!'
00:15:41.690 It was interesting to see how many conventions and assumptions we just understand after using computers for a while.
00:15:50.220 It was fun to teach her about the oddities of computer programming.
00:15:57.450 Next, we explored command line utilities that come with the Raspberry Pi camera.
00:16:04.200 What does 'raspistill' do?
00:16:10.320 It creates a new file with a picture!
00:16:15.930 It will pop up a little preview and then take a picture, saving it as a JPEG where you specify.
00:16:21.930 Next dad tip while programming with kids: Focus on things that provide fast results.
00:16:28.630 Within minutes of plugging in the camera and booting up the Raspberry Pi, we got images working.
00:16:35.650 It's great to make things visual and provide immediate feedback, so kids can stay engaged.
00:16:42.930 Now, let’s look at the code we wrote. This is what we ran on the Raspberry Pi.
00:16:48.880 At the top, the 'loop do' command means taking a picture repeatedly.
00:16:55.600 Then we used 'raspistill' to take the picture.
00:17:01.770 And 'sleep' followed by the desired time in seconds determines how long to wait between pictures.
00:17:08.760 We wanted a reasonable amount of time to pass, knowing that it takes about 10 minutes for a chicken to lay an egg.
00:17:16.690 We chose to take pictures every two minutes.
00:17:23.420 This was also an upgrade because Korra started using the Atom editor, which many programmers use daily.
00:17:31.600 More importantly, Atom is customizable!
00:17:36.800 What was the first thing we changed to set ourselves up?
00:17:44.300 We changed the background color.
00:17:51.260 We would like to thank Amy Wilbois for her Fairy Floss theme. It works wonderfully for Sublime and Atom.
00:18:01.100 Let’s move to the next dad tip. There are some drawbacks to the coding we showed.
00:18:08.430 As a developer, my instinct was to use a gem for interacting with Amazon.
00:18:16.100 I quickly realized it would be boring for Korra to get into.
00:18:23.560 Instead, we took the commands we used in terminal and placed them in backticks.
00:18:32.220 It wasn’t as reliable or had good error handling, but it worked, and we received quick feedback.
00:18:39.580 When you work with kids, focus on having a good experience.
00:18:44.399 The Raspberry Pi is only one aspect of the software equation.
00:18:52.850 The other is Shoes.
00:18:58.130 Shoes is a GUI library for Ruby that allows us to write desktop applications.
00:19:05.220 I've discussed Shoes at several conferences, and if you're interested, come talk to me.
00:19:12.600 When we're writing a Shoes program, what's the first thing we do?
00:19:19.169 We draw it on paper first!
00:19:23.810 We plan before diving into typing out the code. We draw how we want our program to function.
00:19:30.840 This planning is critical when programming with kids.
00:19:38.409 Programming is about understanding and expressing problems and how to use tools effectively.
00:19:45.800 This reflection can happen on paper and in our minds before we start coding.
00:19:51.899 Here's a great picture of Korra working on her programming.
00:19:58.810 What was your favorite part of writing the Shoes application?
00:20:05.060 Experimenting with how it looks!
00:20:11.840 One of the great aspects of Shoes and similar tools is the fast feedback you can receive.
00:20:19.510 We often spent as much time customizing how it looked as we did writing the initial program.
00:20:28.190 What did we customize about this application, Korra?
00:20:35.220 We experimented with the colors for the characters.
00:20:43.680 We also adjusted the window size and worked with the pictures.
00:20:51.500 Let's take a quick look at the Shoes code we wrote before we move to a demo.
00:20:59.510 This is a basic Shoes app, and it's quite minimal compared to some other UI frameworks.
00:21:06.510 What do we do first in our code?
00:21:13.270 We ask the user to input any number.
00:21:19.100 Then, we ask what day they want to see on the pictures.
00:21:26.560 This is another point where I thought we should interact with Amazon’s API, but it was simply easier to just download the files.
00:21:33.600 We had more fun that way, and it was a better experience overall.
00:21:41.820 Almost time for the demo, but I have one more quick tip.
00:21:47.660 As much as possible, let kids have control and guide them; don't just dive in.
00:21:53.220 It takes patience, but you're the adult, so you can afford to be patient as part of your job.
00:22:00.010 Alright, let's get ready for the demo!
00:22:05.430 May I take the keyboard for a moment and get us set up?
00:22:13.510 Here we go! That's my dad and me when I was five.
00:22:20.010 I think we're ready now! Remember, that's the Raspberry Pi with our program.
00:22:26.190 We'll run it with Shoes.
00:22:33.020 So you want to start the Shoes program, and then you have to tell it the file.
00:22:38.230 There it is! She learned how to navigate this and it makes me so happy!
00:22:43.720 Okay, ready to hit it?
00:22:51.660 So what date do you want?
00:22:58.270 There's a very specific day you want—tell me the numbers!
00:23:06.600 September 25, 2016.
00:23:15.210 The secret story here is that as soon as we finished the project, we had about two days of the chickens actually laying eggs.
00:23:23.030 They haven't laid anything since, which is a bit annoying.
00:23:29.840 Alright, it's time to run!
00:23:36.870 Yay, there we're seeing the red hen, and there's an egg!
00:23:42.840 Let's watch a little longer; it will get dark soon.
00:23:50.650 We can see the chickens moving around in the coop.
00:23:57.530 One chicken is sneaking in on the edge, and it's going to get darker.
00:24:05.030 The Raspberry Pi is quite light-sensitive, too, and we can see it cut out.
00:24:10.510 My dad took the egg, and we shipped it out too!
00:24:17.270 That was the plan for our demo.
00:24:21.080 Now, what are some ideas we thought about for next steps?
00:24:30.120 First off, improving the lighting would help.
00:24:38.130 Better lighting in the coop means the camera wouldn't cut out as early.
00:24:45.150 We could simply change the light positioning to improve success.
00:24:53.110 Next, we need better date selection.
00:25:01.430 Instead of typing the exact string for the date, we could implement a calendar selector.
00:25:07.590 That would definitely enhance user experience!
00:25:14.490 Moving forward, we could also play with the size of the images.
00:25:19.380 The images might have been too large, causing some display issues.
00:25:26.430 I've heard of people successfully streaming video off of a Raspberry Pi, which is very fascinating.
00:25:33.570 Another idea involved OCR.
00:25:41.670 Optical character recognition could help us distinguish which chicken laid an egg.
00:25:47.180 Also, we can create a mechanism where the Raspberry Pi captures a picture right as the chicken lays an egg.
00:25:55.020 One more idea was to automate the coop door opening and closing.
00:26:02.950 Currently, I have to let them out every day in the morning and ensure I close it at night.
00:26:10.830 We need to avoid predator issues, like raccoons.
00:26:17.750 I once forgot to shut it at night, and a raccoon came.
00:26:25.460 Thankfully, none of the others were harmed!
00:26:35.390 Any other future ideas?
00:26:43.830 Thank you! Any questions?
00:26:50.390 Yes, the question was about automating the door open and close.
00:26:59.389 It would primarily rely on light detection.
00:27:05.450 Chickens usually head into the coop at dark, so if we can detect that, we could automate.
00:27:12.580 We need a better mechanism to shut the door quickly.
00:27:20.500 The last time a chicken was lost was around 10 or 11 PM.
00:27:27.970 I didn't even hear the sticks crack, which might have indicated something was off.
00:27:35.330 Using a glass door, we can gauge their movements, too.
00:27:43.160 Someone said about exploring the OCR options for recognizing chickens.
00:27:50.670 We've talked with experts to investigate how they recognized magic cards through OCR.
00:27:58.820 The technology could be crucial for identifying the positioning of our chickens.
00:28:06.740 It’s possible to develop flags for pictures when changes are detected.
00:28:15.010 Any other questions?
00:28:20.520 So the question was whether the Raspberry Pi can play music for our chickens to sleep.
00:28:34.679 What do you think, Korra? Should that be on our future list?
00:28:40.838 Yes! That could brighten up their environment.
00:28:48.039 Especially the Star Wars program!
00:28:51.580 So what was your favorite program we made?
00:28:57.860 The princess game! That was our first big program.
00:29:04.509 It was kind of an adventure game with your artwork.
00:29:11.990 Yeah! We could create another one.
00:29:18.880 So do you explore programming without me?
00:29:24.340 Not much yet, but I'm beginning to run programs on my own.
00:29:30.500 I hope to modify and extend them some day.
00:29:36.530 Do you have programming friends?
00:29:42.750 Not really, but at school, I do some coding with my friends.
00:29:50.150 We use code.org during library time, which has been fun.
00:29:58.050 Yay for pairing!
00:30:04.050 Since our chickens look similar, could we add markings?
00:30:11.570 That's certainly possible! It would help differentiate them.
00:30:18.610 We also talked about using RFID tags to track them better.
00:30:27.130 Some chickens are meaner to others, and we must be aware.
00:30:34.040 Do chickens lay eggs in the same spot?
00:30:40.320 Some chickens consistently lay in the same spot, while others vary.
00:30:47.640 In the lower half of our coop, they can even lay eggs in an enclosed area.
00:30:57.950 We've found their behavior can be quite unpredictable.
00:31:05.950 Thank you so much for your questions!
00:31:12.060 Thank you!
Explore all talks recorded at RubyConf 2016
+82