Coding

Background

Computer, web and embedded programming.

Coding posts...

  • Environmental monitoring with online data logging to Thingsv
  • Over the past few months, I have continued to develop the electronics and programming aspects of this project. I now have a system for evualating power potential and environmental sensing, and logging all that data online to Things Speak, an open Internet of Things Platform. Previous to using Things Speak, I was logging data to an SD card. However, with an SD card, I need to periodically pull the data from the card. Extra work. Using Things Speak, the data is available to me and everyone else instantly, everywhere. There have been some issues with wifi stability and internet connectivity...

  • Distributed Version Control : GIT
  • Git is an actively maintained, free and open source, distributed version control system originally developed in 2005 by Linus Torvalds (Linux). Distributed version control systems help software development teams collaborate on projects' source code by maintaining a full history of file changes across a decentralized file system. The distributed architecture maintains a full history of all changes in every developer's local working directory, aka repository. Redundancy. Git is flexible. Git works across all platforms, supports branching and tagging as first class citizens and operations within, such as merging or reverting. Open sites such as GitHub or GitLab are fantastic for...

  • Grow monitors | What watches the watchers?
  • Simultaneous to the module development, I will produce some grow module monitoring equipment. Previously, I worked with a phototransistor sensor, an LCD output and wrote a basic graphical interface for live monitoring the phototransistor readings. Today, my goal is to combine these with voltage sensoring so I can begin tracking the correlation between sunlight and power generation in the bioelectrochemical testing modules. Starting with a little research, I found that by simply connecting an input voltage to an open ADC pin, I could take voltage readings. Duh. I have been doing this for weeks via the phototransistor. I returned to...

  • Fireflies and grasshoppers.
  • I would like to start with the Firefly plugin in Grasshopper and see if I can control a stepper motor. If I can get a successful start with that, then I might be able to incorporate dishuBot controls through Grasshopper/ Firefly rather than GRBL. This would be directly connected to my G-code transcoder. There are a few challenges. One, Firefly has not been released on the MacOS, my operating system. Two, I need to learn to setup code for the board to accept commands through serial from Firefly. This is an example of Firefly reading and parsing live hand tracking...

  • Infrared networking
  • Now I that I have a master-slave network setup, I would like to see if I can get the two boards to send signals back and forth autonomously. First, I extended the sensor test sketch to react via its LED and the serial monitor. I kept the serial monitor so I could debug along the way. One board is transmitting IR signals at random intervals. The other board is checking the IR receiver and when a signal is sensed, it triggers the LED on the board to illuminate for a short time period, then resumes loking. First the code for...

  • Processing Light Graph
  • Enough with the tutorials. Now I would like to start putting these together with some kind of simple visual or audio interface connected to sensor readings. I started by looking at this former Fab Academy student's work mapping phototransistor settings to a dynamically configurable 3D model. He was able to combine sensor readings from arduino with a Processing sketch from Open Processing Org, a wonderful place for sharing processing sketches. I went there with the intention to grab a sketch, however I was a little overwhelmed so instead I started looking at former Fab Academy students' pages for a sketch...

  • Processing : coming around.
  • In graduate school, I had the fortune of learning a bit of Processing, which I used in an interactive design project called FIZZLE in Hollywood. That was then, this is now. Now is a time when I have forgotten everything. Until today. From the processing website: "Processing is a simple programming environment that was created to make it easier to develop visually oriented applications with an emphasis on animation and providing users with instant feedback through interaction. The developers wanted a means to “sketch” ideas in code. As its capabilities have expanded over the past decade, Processing has come to...

  • Testing the electrical components of the IR network twins
  • Infrared light is invisible to the human eye, so it is a challenge to know if the infrared LED is operational. Further, the sensors need to be operationally tested. I setup some simple arduino sketches to confirm the board. First, you need to match the ATtiny44 pins to Arduino speak. Look at this graphic and compare it to the schematic. The LED is on ATtiny 12, irLED 11 and irSensor 10. One, two, three. I will add those as integars. Now, many cameras can see infared light. The front camera on newer iPhones is one such camera. const int irPin...

  • Chinese calligraphy G-code encoder
  • When writing Chinese characters, there are rules. You can either abide or you will be revealed a fraud. When we first tested the machine, we tried several online g-code generators (link?). One thing we did not find was a good way to specify stroke ordering and directionality. I was excited to show some Chinese people the first successful tests of our machine and everyone criticized the machine's stroke order! I started to investigate the possibility to write code we could use to generate g-code which follows the basic principals for patterning strokes in Chinese characters. And, this was a good...

  • Bio-electro-chemistry
  • The fabrication demands of this project are far less than other aspects. Keep it simple. Spiral develop. I essentially want an open-faced cube in acrylic. I will develop a grasshopper, parametric model with variables for overall dimensions, finger joint size, laser kerf, bolt and other holes (unrelated to box adhesion). The prototype is based on the work of Paolo Bombelli, et al. This is the desired composition. The pot, plastic fixture and possibly rubber washers will be laser cut and Jakob Skote's Moss Powered Wifi Jammer project. Excellent work. Visit them. Fast-forward a little in time and I have a...

  • Phototransistor : reading
  • I will try a variety of programming languages until I get readings. I am pulling VCC and Ground connections from the ISP so my order of operations: program with my fabISP, disconnect fabISP and connect phototransistor VCC and GND. That looks like this. I thought this might be simple... I first tried this Arduino sketch for getting readings via the serial monitor. Unfortunately, I am not yet able to get any reading from the serial monitor, let alone light levels. // Using an ATTiny44 #include <SoftwareSerial.h> SoftwareSerial mySerial = SoftwareSerial (1,0); // RX PA1 12, TX PA0 13 // Pin...

  • Prototyping the effector
  • The effector pushes the brush into the drawing surface and pulls it away. Included in the mechanism is the flow of water from the reservoir into the brush tip. This design uses a 2BBYJ-48 stepper motor we had in stock in the lab. Precision of movement is not needed. In the design of the stage, I left some gaps that could be used to attach an effector shield. We also looked at an effector designed by Simone Boasso previously. With these starting points, I designed this: I created a larger guide for the vertical movement with a perpindicular axis for...

  • LCD x Arduino
  • Arduino has a built in libary, "LiquidCrystal.h", for programming this type of LCD. I thought it would be fun to imagine a prototype of HAL 9000 prior to artificial intelligence using the LCD display to communicate and the LED to hint life. Arduino IDE is packaged with many sketches of LCD functions. Browse to File > Examples > LiquidCrystal and you can check those out. First, write in the sketch the command to send the library for the LCD. #include <LiquidCrystal.h> Then, you need to dictate which MCU pins are connected to the RS, E, DB4-7 pins of the LCD...

  • Programming "Hello to the World" with C
  • I tested the effectiveness of my build with a C program written by Neil Gershenfeld. The contents of the make file are mostly the same as my previous ATtiny44 board. Because I used the same resonator, the timing fuses are the same. Only the name of the C accompaning C file has changed. Create the hex and out files. make -f hello.LCD.44.make Using my FabISP... make -f hello.LCD.44.make program-usbtiny-fuses and then send the program... make -f hello.LCD.44.make program-usbtiny This feels good. Download project files

  • Fabricating a gestalt stage
  • After much intense strategic consternation, we decided to begin our project by developing through the Gestalt framework. The framework is developed; we are beginners. Can we connect rotary stages on either side of a linear stage equipped with a brush effector? The idea is similar to a common CNC machine. Wheels mobilize the whole assembly along an infinite X axis. A stage holding an effector moves a limited distance between two wheels (Y). The effector moves a minimal distance along the Z axis. The first step is to fabricate a linear stage. Download the Rhinoceros file and you may need...

  • Breathing light : An arduino experiment
  • I now have a grasp of making slight adjustments to code and uploading code to my board. Now that I have a little taste, I want more, so I imagined a simple idea to go a step beyond the tutorials and example codes. An interesting thing to me about coding is how the process is not linear, like what can often happen in other design fields. I can start layering in code and then make a little game of optimizing that code for editing, total number of executions, or number of lines, for instance. In fact, speaking of games, I...

  • Datasheet Atmel ATtiny24/44/84
  • Datasheets are hardcore product manuals for instructing makers on how to integrate specific products (ie electronic components) into systems. Datasheets are typically created by the product manufacturer and include technical and performative characteristics, connectivity information, coding examples, etc. A datasheet for an electronic component, such as an MCU like the ATtiny44, typically contains the following: Feature list and overview Pin configurations and descriptions Timing diagrams Reset and interrupt handling Register description Memories details Input/output informations Clock system Power management Packaging details and configurations and much more! This is the first time I have read a datasheet and I have only...

  • Echo : Programming.c
  • I am testing the assembly of the board by attempting to program it using C... for the first time. Start by downloading the Makefile and the echo hello-world C program written by Neil Gershenfeld. To make things simpler, rename the *.make file to simple "Makefile". No extension. In MacOS the best way to do this is in the file information dialogue. Open the Makefile with a neutral editor, such as Textedit to learn about its setup. The first group of lines refer to the project name, the source of the project (echo hello-world C program), the Micro-controller (ATtiny44), and the...

  • Programming a programmer
  • An in-circuit serial programmer (ICSP) is capable of programming microcontrollers on various boards with only a universal serial bus (USB) cable and 6-pin insulation-displacement contact (IDC) to 6-pin IDC cable. The ICSP vastly simplifies what would otherwise be an expensive and laborious process across different chip types. First I installed Crosspack on my mac. Crosspack is a development environment for AVR microcontrollers and necessary to give the terminal app capability for the upcoming task. Next, from the FabTinyStar page, I downloaded the firmware source code. I added a link here as well. You can open the Makefile with a neutral...

  • Arduino IDE, introduction
  • This is Arduino: a family of open-source, programmable Atmel microcontroller-based boards an abstraction on top of standard C syntax and libs a cross-platform IDE a bootloader that can upload code without a hardware programmer a micro-USB port to plug into the computer, digital/analog input/output pins, a separate power jack, an ISP header, and a reset button For my purposes today, I will be using the Arduino IDE, an application written in Java in combination with my own fabbed TinyISP. In my limited experience, it is quite similar to Processing. (Unfortunately, I have forgotten everything else about Processing.) Programs may be...

  • Grasshopper Parametric Modeling
  • I decided to try learning the Rhinoceros parametric GUI plugin Grasshopper for the cutting prototype. The Grasshopper project's aim is to make programming easier to understand through an intuitive visualization. The GUI looks similar to Antimony with a model window and a graph window. Scripting nodes in Python, C#.net and VB.net is also possible. Grasshopper is available with Rhinoceros on MacOS and Windows. Launch Rhinoceros. Enter "grasshopper" in the command line. The Grasshopper interface will launch. Across the top are several tabs which contain links to "objects" which are scripts of varying complexity. The primary section of the screen is...

  • HyperText Markup Language : HTML
  • HyperText Markup Language (HTML) is the standard language for web pages and web applications. The language is written into a document that could be made in any type of word processing (i.e. textedit, notes), specialized webcoding application, or sometimes within a browser. That document is then saved on a webserver. A domain directs a visitor to that webserver and their browser renders the code. There is a basic structural semantic for levels of headings, paragraphs, sections, lists, everything. HTML is not meant to include stylization (font types, alignments, borders, everything). Adding that makes coding too unwieldly. The best way to...

  • Cascading Style Sheets : CSS
  • CSS describes how HTML elements are displayed. Because one piece of CSS code can alter the behavior of all of any single HTML element throughout all the pages of one website (or even multiple websites), writing CSS can save loads of time and effort customizing appearances. CSS can add background images or color, borders, change font attributes such as: style, color, and/or typeface, set margins, adjust website sizes for different devices, create image galleries, all sorts of great stuff. This is CSS: selector { declaration: value; } Or from the version of this website dated 2017.2.21: body { font-family: 'courier...