Charlie Gerard
Charlie is a front-end developer at Netlify, a Mozilla Tech Speaker and Google Developer Expert in Web Technologies. She is passionate about creative coding and building interactive prototypes mixing science, art and technology. She also spends time giving back to the community by mentoring new developers, contributing to open-source projects, and speaking at conferences.
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
6 min
Charlie Gerard's Career Advice: Be intentional about how you spend your time and effort
When it comes to career, Charlie has one trick: to focus. But that doesn’t mean that you shouldn’t try different things — currently a senior front-end developer at 
, she is also a sought-after speaker, mentor, and a machine learning trailblazer of the JavaScript universe. "Experiment with things, but build expertise in a specific area," she advises.
What led you to software engineering?
My background is in digital marketing, so I started my career as a project manager in advertising agencies. After a couple of years of doing that, I realized that I wasn't learning and growing as much as I wanted to. I was interested in learning more about building websites, so I quit my job and signed up for an intensive coding boot camp called General Assembly. I absolutely loved it and started my career in tech from there.

What is the most impactful thing you ever did to boost your career?
I think it might be
public speaking
. Going on stage to share knowledge about things I learned while building my side projects gave me the opportunity to meet a lot of people in the industry, learn a ton from watching other people's talks and, for lack of better words, build a personal brand.

What would be your three tips for engineers to level up their career?
Practice your communication skills. I can't stress enough how important it is to be able to explain things in a way anyone can understand, but also communicate in a way that's inclusive and creates an environment where team members feel safe and welcome to contribute ideas, ask questions, and give feedback. 
In addition, build some expertise in a specific area. I'm a huge fan of learning and experimenting with lots of technologies but as you grow in your career, there comes a time where you need to pick an area to focus on to build more profound knowledge. This could be in a specific language like JavaScript or Python or in a practice like accessibility or web performance. It doesn't mean you shouldn't keep in touch with anything else that's going on in the industry, but it means that you focus on an area you want to have more expertise in. If you could be the "go-to" person for something, what would you want it to be? 

And lastly, be intentional about how you spend your time and effort. Saying yes to everything isn't always helpful if it doesn't serve your goals. No matter the job, there are always projects and tasks that will help you reach your goals and some that won't. If you can, try to focus on the tasks that will grow the skills you want to grow or help you get the next job you'd like to have.

What are you working on right now?
Recently I've taken a pretty big break from side projects, but the next one I'd like to work on is a prototype of a tool that would allow hands-free coding using gaze detection. 

Do you have some rituals that keep you focused and goal-oriented?
Usually, when I come up with a side project idea I'm really excited about, that excitement is enough to keep me motivated. That's why I tend to avoid spending time on things I'm not genuinely interested in. Otherwise, breaking down projects into smaller chunks allows me to fit them better in my schedule. I make sure to take enough breaks, so I maintain a certain level of energy and motivation to finish what I have in mind.

You wrote a book called
Practical Machine Learning in JavaScript.
What got you so excited about the connection between JavaScript and ML?
The release of TensorFlow.js opened up the world of ML to frontend devs, and this is what really got me excited. I had machine learning on my list of things I wanted to learn for a few years, but I didn't start looking into it before because I knew I'd have to learn another language as well, like Python, for example. As soon as I realized it was now available in JS, that removed a big barrier and made it a lot more approachable. Considering that you can use JavaScript to build lots of different applications, including augmented reality, virtual reality, and IoT, and combine them with machine learning as well as some fun web APIs felt super exciting to me.

Where do you see the fields going together in the future, near or far? 
I'd love to see more AI-powered web applications in the future, especially as machine learning models get smaller and more performant. However, it seems like the adoption of ML in JS is still rather low. Considering the amount of content we post online, there could be great opportunities to build tools that assist you in writing blog posts or that can automatically edit podcasts and videos. There are lots of tasks we do that feel cumbersome that could be made a bit easier with the help of machine learning.

You are a frequent conference speaker. You have your own blog and even a newsletter. What made you start with content creation?
I realized that I love learning new things because I love teaching. I think that if I kept what I know to myself, it would be pretty boring. If I'm excited about something, I want to share the knowledge I gained, and I'd like other people to feel the same excitement I feel. That's definitely what motivated me to start creating content.

How has content affected your career?
I don't track any metrics on my blog or likes and follows on Twitter, so I don't know what created different opportunities. Creating content to share something you built improves the chances of people stumbling upon it and learning more about you and what you like to do, but this is not something that's guaranteed. I think over time, I accumulated enough projects, blog posts, and conference talks that some conferences now invite me, so I don't always apply anymore. I sometimes get invited on podcasts and asked if I want to create video content and things like that. 
Having a backlog of content helps people better understand who you are and quickly decide if you're the right person for an opportunity.
What pieces of your work are you most proud of?
It is probably that I've managed to develop a mindset where I set myself hard challenges on my side project, and I'm not scared to fail and push the boundaries of what I think is possible. I don't prefer a particular project, it's more around the creative thinking I've developed over the years that I believe has become a big strength of mine.
Follow Charlie on Twitter

Building Brain-controlled Interfaces in JavaScript
JSNation Live 2021JSNation Live 2021
27 min
Building Brain-controlled Interfaces in JavaScript
Neurotechnology is the use of technological tools to understand more about the brain and enable a direct connection with the nervous system. Research in this space is not new, however, its accessibility to JavaScript developers is.
Over the past few years, brain sensors have become available to the public, with tooling that makes it possible for web developers to experiment building brain-controlled interfaces.
As this technology is evolving and unlocking new opportunities, let's look into one of the latest devices available, how it works, the possibilities it opens up, and how to get started building your first mind-controlled app using JavaScript.
About Charlie
Hi everyone. Thanks for joining me today to learn more about how to build brain controlled interfaces using JavaScript.
Before we dive into this topic, here's a little bit more about me. My name's Charlie Gerard, I'm a senior front end developer at Netlify. I'm also part of the Google developer experts group. Interwind web technologies. It's a community group. That's sponsored Google for developers who like to give back to the community in different ways. I'm also the author of a book about TensorFlow JS for JavaScript developers. And most of all, I spend a lot of my personal time building and researching prototypes about human computer interaction, which is also called HCI. And that's the study of the design and use of computer technology focused on the interfaces between people and computers. So it can involve a lot of things like AR VR, interactive arts, machine learning, et cetera.
[01:12] And I've been interested in this since I started learning to code. And throughout the years, my research has led me to the topic of today. So it has nothing to do with my day job at Netlify, but hopefully this talk will show you that you can use your JavaScript skills for a lot of different things
Using brain to interact with interfaces directly through JavaScript
[01:27] So the focus of today is our brain and how to use it to interact with interfaces directly using JavaScript. So how are we going to get data directly from our brain activity and write some JavaScript code to use it, to interact with interfaces or devices? So how do we even get this data from our brain? So we do this with the help of brain senses. So these are devices that contain electrodes that you placed on the scalp and in contact with the skin, they're able to transform the electrical signals coming from the brain into digital data that we can work with.
So on this slide, I put a few of the commercial brain sensors that you can buy currently, and you can see that they come in different shapes, they have different number of electrons, and that will impact what you're able to track and what kind of applications you're able to build with it. There's probably more brain sensors available out there, but here are the ones that I mostly heard or played with. So the one that the talk is going to focus on is the one on the bottom, right? That is called the Neurocity Notion they've recently released a new model called the Crown. So if ever you're interested in buying it, it might be called the Crown now, but I experimented with one of their very first version that was called the Notion. So to understand how the number of electrodes impacts the use cases. And it's still briefly talk about how that works.
[02:45] So in the context of the Notion device, I highlighted in green the placement of the electrodes based on their reference number on the 10 20 EEG system. So this is a system that's a reference in your technology, and it's the kind of map representing the placement of electrodes on the user's head. So at the top is the front of your head. And at the bottom is for the way down the back. And each electrodes has a reference number and letter, so these are important because it will give you an idea of the type of brainwaves that you can track depending on the area of the brain that the electrodes are closest to. So the new Notion has eight electrodes, four on the left side of the brain and four on the right side, mostly focused on the top and the front of the head. So this is important to know, because depending on the placement of the electrodes, you will get data from different parts of the brain. So it means that you will, what you can interpret from the data that you're getting will vary.
[03:41] So here I made a small animation to explain what I'm talking about. So at different parts of the brain have different purposes at the front. You have the frontal lobe, but then the cerebellum is at the lower back. The parietal will look at the top, et cetera. You don't have to know this heart, but it might not mean too much to you right now, but they're in charge of different physiological functions.
So for example, the frontal lobe is in charge of voluntary movement around concentration and problem solving the parietal lobe at the top is more focused on sensations and body awareness. And the temporal lobe is the one on the side that receives sensory information from the ears and processes that information into meaningful units suggest speech and words.
[04:22] So depending on what you'd like to track or build, you will want to check different brain sensors electrodes position to see if they're more likely to be focusing on the area of the brain that you're interested in. For example, one of the brain sensors on one of the previous lines is called next mind, and it mostly focuses on the occipital lobe at the middle back because they claim to be focusing on the users' vision to try to predict what somebody is looking at.
So anyway, now that we've talked about a brain senses, what does it look like for us as JavaScript developers? So with neurocity Notion that you have access to a UI in which you can see different graphs. So here is the part of the UI where you can see your real brainwaves. So you can see the different lines. There's eight of them. And each label responds to the name of an electrode position based on the 10 20 EEG system that I talked about a few slides ago. So this represents a wrap up the real data coming live from, from the brain sensor.
[05:18] But in general, when you get started in this space of neuro technology, you don't start straight away experimenting with raw data. Most of the brain sensors out there have implemented things like focus detection or calm detection, or that you can use without having to build your own machine learning model. So focus and calm detection don't need any training because they rely on a pattern of brainwaves that are pretty common, almost everybody, however, custom mental comments have to be trained.
So what do I mean that? Don't want the reading the entire list, but for the Notion headset, the comments you can train are focused on imagining specific movements. So you can see biting a lemon or pinching your left finger, or thinking about pushing something in space. It sits around. And for example, here's what the training, the right foods, mental content looks like. So you can do it also with the API, but in general, to do it faster, you do it through their UI.
[06:12] So you have two animations playing every few seconds to guide you into what you're supposed to do. So you have to alternate between states of focusing on that comment. So thinking about tapping your right foot on the floor and also resting where you're supposed to try to think about nothing at all, while you're doing this, your brain data is recorded and the machine learning algorithm tries to detect patterns between the two types of mental activity. So it can then predict accurately if you're focusing on the right foot thought or not.
So this training session lasts a few minutes and you can test if it works in the UI, otherwise you should retrain it and see how you get predictions to be more accurate. It can be a bit difficult because it requires a focus and it feels weird at first to be like, to have to think about movements without actually doing them. But it's an interesting exercise. And when it works, it's pretty exciting when you're able to actually think about moving your right foot and being able to trigger something in the UI. It is pretty cool.
[07:12] But this also means that the training sessions are personalized. If I train the right foot comment for me, it will learn based on my brain data. So if I ask a friend to wear the brain sensor and try to execute a right foot comment, it will likely not work because the brain data I might be a difference. So then once you train the platform to recognize patterns in your brainwaves, you're able to use it in your code. So let's look through a few examples.
[07:37] So the first one we're looking to is the calm and focus detection, because it's kind of like the fastest one. So you start importing the Notion NPM package. Then you instantiate the Notion with New Notion, and then you're able to subscribe to a few different events. So here we subscribed to the calm event and what it returns is an object with multiple properties, including the probability of a calm state. So then what you're able to do, for example, you can trigger UI events when the probability of being calm is over or under a certain threshold. So here, if the probability is down to 0.25, so if I'm not really calm, we could trigger some classical music to try to console him down and see if the probability increases.
That probability number is between 0 and 1, meaning 0, not calm and 1 really calm. And what is nice with the Notion headsets in their API is that it's pretty similar for different events in terms of syntax. So here's the syntax to get the user's focus to states.
[08:42] So you can implement the calm states in your code. You don't have to change much to then move on to subscribing to the focus states. So here in this good sample. If my focus is over 0.5, turn off my, so I don't get distracted, distracted and lose focus.
So now apart from calm and focus, there's also the Kinesis API that's available for the mental comments I talked about earlier. So you subscribe to the Kinesis event you want to use. And it also returns to the object with a probability of that comment being executed in your mind.
[09:14] So a machine learning algorithm is looking at the life brain data and tries to detect if the pattern is similar to the right arm comment that you trained, and it gives you the probability or the accuracy of the prediction. So what you'd probably want to do is trigger something like a UI event. If the probabilities is over 0.99, for example, if you needed to be very accurate, but if you want to be a bit more flexible, you could trigger an event. If the probability is over 0.8, for example, it's really up to you.
And then finally, if you do want to work with your data, you can subscribe to the brainwaves events. And it returned an object containing the data from the eight channels of the brain sensor, as well as frequency and PSD for a power split transitivity, I believe, which is a representation of grower data once processed and also a timestamp.
[10:02] So the timestamp is important because the data that you're getting is lossless. So you will get all the data from the brain sensor, but then it means that you might have a little, a little delay to receive it. And what it allows you, the types of symptoms that cause you to compare the current time in your UI to the time at which the brain, the data from the brain sensor was actually tracked. So depending on the type of application that you're building, this might actually be really important. 
[10:30] So now that we've talked about the different kinds of events or states that you can track using the Notion and how to use that in JavaScript, I'm going to show a few example of things that I have built using this sensor.
So my first ever demo that I built with the Notion was a prototype of street fighter game controls with mental comments.
So for this, I actually repurpose a previous demo that I had built using gesture recognition. In my previous demo, I was using another piece of hardware that had an accelerometer and gyroscope. So usually a device that's around tracking speed and rotation. So I recorded live data while executing real punches and hurricanes in the air and used machine learning to find patterns from this gesture data, and then be able to predict hurricanes and punches again, but from live data to apply it to the game. So I could play street fighter in real life instead of using the keyboard. As this previous demo  worked, I thought I wanted to try to repurpose most of the codes, but use mental commands as triggers instead, and it worked. I trained two different mental comments and then triggered the game when the probability of the comments were over a certain threshold.
[11:46] Okay. My second demo was using a single mental comment. So you've probably played the Chrome dyno game before, but it needs a single input usually pressing on the space bar. So I thought it was the perfect use case for using it with the Notion. In this case, I didn't need to build a custom UI. I didn't modify anything in the original UI of the Chrome dyno game. I only trained the right foot metal command and then used a NodeJS package called RobotJS that allows you to trigger events like clicks or keyboard events to trigger the space bar for me. So to me, this is the perfect example of a simple interface that doesn't need to be adapted to work with the brain sensor. I only had to add the connection between the brain sensor and the UI.
[12:30] To show you how quick it can be to put this together let's pick up the code.
So this is basically the entire code for the demo on the previous slide. So it's done in no JS. So you start requiring the Notion and the RobotJS packages. And you instantiate the Notion. Then you log in with your username and password, or that you can say either in a dot end file, or you can write them directly if you're prototyping locally. Because what I did not mention before is that you have to log in to be able to use your device because the data for like privacy and to be able to use your own data and for not everybody to be able to have access to that, then you subscribed to the Kineses API with the mental comment that you trained, you get them on a probability. And if it's over a 0.99, or any number of that, you want to set I use RobotJS to trigger a key tab on the space bar and that's it. Then I ran my Node.JS script. I visited the Chrome dyno game page. And voila. So you can see that there's not much difference between using the API in the frontend and backend, which is pretty cool.
[13:43] And my latest demo is my most advanced using real brainwaves for the first time. So in this demo, I recorded my brain waves between a neutral state and intentional eye blinks. So I built my own machine learning model. And then I was able to predict these eye blinks from life data. So in this demo, it doesn't look like much because it's a very rough first prototype, but it means that I can control interfaces or devices using intentional eye blinks when I'm wearing the sensor.
So there's many ways to detect eye blinks using computer vision in JavaScript. But the issue with computer vision is that you have to be placed in front of your computer. So the lighting  has to be enough for that addiction to work. Sometimes some tools don't work with people with different skin tones etc. So I was excited to get it to work with brain data because now it means it can be, I can be anywhere in the room and control my interfaces or devices. It doesn't matter if it's day or not, and the lighting doesn't affect anything. And it would work with people with different skin tones.
[14:48] So my next goal would be to be able to gather data and train the model to recognize eye movements between left and right. So it could be, it could give more flexibility to users and it means more ways to interact with an interface. You could imagine the intentional blink would be playing or pausing a video or a song. And then looking left will be playing the previous one and right would be playing the next one.
[15:10] So, yes. Yeah. So now that we talked about how, what we can track and how to implement it in code, and we went through a few demos, let's talk about more applications for technologies like this.
So one of them is around detecting focus while you're working to optimize your workflow. So there's already an existing JS code extension that you can even install that tracks your brainwaves as you're working. So it could be interesting to know the times of the day when you're the most focused or maybe the parts of your code base that you find the most difficult, or, you can be able to analyze your drops in focus states and, and calm state, and be able to see what happened in your environment to provoke that.
[15:53] Another application is in scrolling webpage. So it can be useful for accessibility. If a user is unable to move, they could read a page using a mental comment, but also it could be useful for anyone. If you're used to doing multiple things at once, your hands are busy doing something else. If you're cooking or eating, you want to be able to scroll down different pages or stop a YouTube video while you're cooking or anything that you could do that with your brainwaves while your hands on doing something else.
[16:24] Another application is the neurocity microwave app. So you can download the code from GitHub and launch this app made with electrons. You can connect your device and trigger the do not disturb mode. When the device detects that you're in a state of high focus.
Now moving on from focus states, you can also build things that are a bit more, maybe creative. If you're a musician, you can also use your brainwaves to help produce your music, here one of the founders of neurocity is triggering an effects pedal with his brainwaves while he's also playing the guitar.
[16:59] So the quality of the gif, maybe it doesn't show it well enough, but the pedal is pushed a few times to show that the sound effect is being triggered. You could think, if you're playing an instrument, I'm sure that you can think about ways where while your hands are playing an instrument, you could use your brainwaves directly to apply certain effects.
[17:19] And finally, something I've been thinking about for the past few days is around passwordless authentication. So using the brainwaves, or brain sensor as a biometric authentication device. So we're already familiar with using a touch ID or face ID to authenticate into devices or services. So we could imagine the same type of system, but using brainwaves instead. Each person's brainwaves have a unique signature. So you can, we can use this to identify someone trying to log into our platform.
So if we're worried about data leaks, when we're using touch ID or face ID, if at any time someone forces you to log into a platform or, use this face ID while you're sleeping or something like this, we can't really create a different fingerprint or modify your face, but using brainwaves, you can retrain the device with a different mental comments that will be unique to you, but different from the one that was stolen. So that can be really interesting.
[18:11] Here, this is a really short demo that I did on Netlify because as I work there, I was able to modify the code myself, but what I would really be interested to see if this is working with real platform authenticators. So we really try to add something to the pitch idea on my Mac.
So that's very early research at the moment, but most importantly, an application can be whatever you're thinking of. I hope that listening to this talk, you might be coming up with ideas of things that you'd like to build using a brain sensor. It's a field that's growing with more and more devices. I've been syncing in hardware and software. And I'd love to see more people come up with ideas for this technology.
[18:51] Remember that you can use JavaScript in a lot of different contexts and that's what's awesome about it. And it's a real advantage to being a JavaScript developer in this space, we build websites that run on like desktop, laptop, iPad, phone. You can go frontend and backend things. You can be build electron apps. You can build AR and VR prototypes. We have frameworks to make music in JS. We can control robots. I mean like it's really super exciting and it's not something that developer using a different language can do because they might not have access to an ecosystem. That's as great as the one that JavaScript has.
Limits of the technology
[19:26] So I've talked a lot about what's possible, but let's briefly talk before I finish about the limits of such technology. So first of all, it's important to know that the quality of the data is different with external brain sensors than it is with implants. Implants have a direct access to the brain as the device is placed really on the brain, whereas brain sensor has to go through layers of skin and skull and hair. So if you find like a demo built another company that uses implants, you have to be aware that the quality of the data that you will get with an external brain sensor is different, and that will impact what you can do.
Another limit is the fact that as the data is lossless and that's great, you get all of it, but working with delays will have an impact on the kind of applications that you can build. If you're building things with focus or calm, I guess it doesn't really matter if you get it if your application changes the states in a second, but if you're really building applications that are really time-sensitive working with timestamps might be a difficulty, but it's something to think about.
[20:31] When you're getting into something like this you have to remember that in a lot of ways, we still don't understand everything about the brain. And we can't really detect things like, I want to trigger something when I'm thinking about the beach, right? It doesn't really work like that. So the type of thoughts that we can detect at the moment is more limited. So it's something that you have to keep in mind when you're getting into a space like this.
And finally, as you know, mental comments need training. If you build an interface, remember that, calm and focus are the same for all users. So you don't need any training. The user will just have to wear the sensor, but if you want something a bit more personalized, a bit more complex, the fact that the user will have to do some training before being able to use the application might be a limitation.
[21:15] The biggest opportunity that I see in this industry at the moment is that as JavaScript developers we can help shape the future of brain controlled interfaces. It's still in early stages, but it's moving fast. And we're in a position where we can give feedback to different companies about what we'd like to get them to do with the brain sensor. We can help shape what the web would look like if it was brain controlled and we can contribute to the different focus, force packages etc. And to me, I really think it's a big opportunity.
On this I'm going to stop here, but hopefully giving you a better idea of what is possible when we talk about rent control on the web. And I hope you're as excited as I am about the possibilities that this technology opens up. Thank you so much for listening. And if you have any questions, don't hesitate to ask in the Q
Q or on Twitter, I'm @devdevcharlie.
[22:05] Maxim Salnikov: Wow. What an inspiring session, thank you much, Charlie, for delivering this at JS Nation and before jumping into Q
A section, let's check what you folks answered to Charlie's question on where you would like to use a JavaScript as a creative coding and the winner is - machine learning. Actually it's a, it was a battle, all the duration of the session between machine learning and augmented reality and virtual reality. And with a very slight, slight difference machine learning won. Now let's invite Charlie to our studio, she's here. Hello.
[22:50] Charlie Gerard: Hi.
[22:51] Maxim Salnikov: Thanks for your session. And we have lots of questions to you. Let me pick some of them. And they're on my second screen. So let's start from the very technical one. You mentioned, you have to think about the action without actually moving, is it because moving creates signal noise? Would moving at the same time interfere with the models training and did you try it?
[23:16] Charlie Gerard: Oh, actually you can move if you want to, but it's just that as in general, when you will want to reproduce that thought you probably will not want to move. Then it's easier to try to train the model without actually moving your body. But you can do both. I prefer to train the model without moving, because I know that when I want to reproduce the thought, I want to do it without moving. But I know that if you look at the project that Neurolink has been doing lately with a monkey that was playing pong, the monkey was moving at the same time as the data was recorded. It is something that I want to try next. But I think that you can do both. I wouldn't know if it creates particularly noise. I wouldn't think so because what the brain sensor is getting is data about you wanting to move your body so I don't think that it would actually create noise, but I would have to try. It's definitely something that I want to do next as well.
[24:22] Maxim Salnikov: Awesome. Awesome. By the way, are you surprised the poll results that machine learning won?
[24:30] Charlie Gerard: I'm not surprised, but I'm excited because machine learning is something that I'm looking into a lot and I've been for the past few years. So I'm excited that other people want to do that too. I think there's a lot to learn in really exciting projects to build so I'm actually excited the poll responses.
[24:50] Maxim Salnikov: Yep. Yep. I bet that after your session more and more folks will use JavaScript creatively for machine learning. So a couple of minutes left, let's take this question and it's a sort of conceptual one. I bet many people's first thoughts are for games, but what kind of interests have you gotten in terms of medical users? What about for psychiatrists and psychologists to use during their appointments to get readings from people as the session happened? And this question was because a lot of counseling moved to online, so it could be a very interesting use case. What are your thoughts on that?
[25:35] Charlie Gerard: Yes. So I think I remember reading some papers about people trying to detect states of potential depression using brain sensors, so that instead of only listening to what people are saying, we would get direct feedback from people's state. If we know that depression is about a chemical imbalance in the brain, there might be things that we can actually detect from a raw brain data about the state of a user, and then being able to diagnose certain things like earlier on, or having real feedback about somebody's emotional state, because sometimes the way we express ourselves, we only do it with the words that we know or the experience we've had in the past. Whereas now we could do it directly with data from the brain. And I think there is research done with this at the moment, and I think it's definitely an interesting one as well.
[26:27] Maxim Salnikov: Awesome. Awesome. So Charlie, thanks for your sessions, thanks for your answers. And it was a great pleasure to have you on JS Nation conference.
[26:37] Charlie Gerard: Thank you so much. Bye.