A.R.T. Version 2 (with instructions!)

December 30th, 2010 § 0 comments § permalink

Today I built a second new A.R.T. to test new configurations.

It’s also because it is a bit frustrating not to have a working version at all times for demos while I’m trying out new mechanical layouts… I took the opportunity to write down a detailed list of parts, tools and steps that I’ve checked in to github (note that I have not finished as I still have to solve the ranging sensor and write a new program):

https://github.com/rngadam/ART/blob/master/ART_Control3/BUILD.txt

See gallery for pictures…

[gallery link="file"] ]]>

First successful autonomous run of A.R.T.

December 27th, 2010 § 1 comment § permalink

  • First time I made holes in a piece of wood with a Dremel
  • First time I bought tie-wraps in China
  • First time I blew up the fuse for Xindanwei putting everyone in the dark when I tried to solder
  • First time I’ve connected the Vin for an Arduino Dueminalove (instead of the external power header or USB)
  • First time I’ve read values from an infrared sensor (E18-D80NK with a Chinese only datasheet)
  • First time I got an autonomous robot to be, well, autonomous – by myself! (video)
  • [gallery link="file"] It’s neither very nice looking or very impressive when it runs, but I’m still very happy with the results.  I planned something electro-mechanical with a tiny bit of embedded software all by myself (with some help from Niko with the Dremel and Héqíchén / 何琪辰 to buy the tie-wraps!). I planned, executed and… got the results I wanted! The simplistic code that I used:
    const int FORWARD =  2;
    const int REVERSE =  3;
    const int LEFT = 4;
    const int RIGHT =  5;
    const int INFRARED_FORWARD = A0;
    const int INFRARED_REVERSE = A1;
    const int MINIMUM_INFRARED_READING = 500;
    int current_reverse = LEFT;
    int alt_forward = RIGHT;
    char current_state;
    void setup() {
      pinMode(FORWARD, OUTPUT);
      pinMode(REVERSE, OUTPUT);
      pinMode(LEFT, OUTPUT);
      pinMode(RIGHT, OUTPUT);
      pinMode(INFRARED_FORWARD, INPUT);
      pinMode(INFRARED_REVERSE, INPUT);
      Serial.begin(9600);
    }
    char update_state(char state, int reason) {
      char previous_state = current_state;
      if(state != current_state) {
        current_state = state;
        Serial.print(current_state);
        Serial.println(reason);
      }
      return previous_state;
    }
    void loop(){
        // always check if we can go forward
        int value = analogRead(INFRARED_FORWARD);
        if(value >= MINIMUM_INFRARED_READING) {
            // maybe we were correcting, so check that
            char last_state = update_state('F', value);
            digitalWrite(current_reverse, LOW);
            digitalWrite(REVERSE, LOW);
            if(last_state == 'R') {
              // we just successfully exited a bad loop, turn for a bit for half a second
              digitalWrite(alt_forward, HIGH);
              digitalWrite(FORWARD, HIGH);
              delay(1000);
              digitalWrite(alt_forward, LOW);
            }
            digitalWrite(FORWARD, HIGH);
        } else {
          // otherwise, still correcting, keep off
          digitalWrite(FORWARD, LOW);
          // we want to try to find an alt path
          int value = analogRead(INFRARED_REVERSE);
          if(value >= MINIMUM_INFRARED_READING) {
            //still have some ability to go backward
            update_state('R', value);
            digitalWrite(current_reverse, HIGH);
            digitalWrite(REVERSE, HIGH);
          } else {
            // whooaah, even backward is not possible, we're stuck
            digitalWrite(current_reverse, LOW);
            digitalWrite(REVERSE, LOW);
            update_state('S', value);
          }
        }
    }
    Wins:
    • Wooden board and tie-wraps work exceptionally well to prototype the physical arrangement
    • Using the breadboard to prototype the electronics also works well
    • The Arduino “Vin” to provide current in the board header works very well (and can seamlessy switch between USB and that without resetting!)
    • Sticking the RF transmitter board directly on the robot and controlling the motors with that from the Arduino works well
    • The LED that comes on when an obstacle is detected by the infrared sensors is very useful for debugging (need to keep that in mind when using other  sensors)
    • It works!
    Losses:
    • Uses Alkaline AA batteries (I want to switch to the exact same Rechargeable NiCad as the car uses)
    • I spent too much time working with Sketchup instead of manually testing the mechanical design first (and then Sketchup)
    • There’s not much around Xindanwei in terms of computer, electronic or small mechanical stores, so I should plan ahead to shop on Beijing road
    • The infrared sensors that I found in the pile of stuff in Xinchejian work, but more like “on/off” sensors (don’t seem to have any linearity in the distance)
    • No bumper (the infrared sensor was crashing into the walls…)
    • Making an obstacle course big enough is annoying
    • I had forgotten to make the holes to attach the sensors (more holes == better)
    • No on/off switch so have to manually remove the connections to turn off power
    • You can never have enough tie-wraps… We only had four at Xinchejian before I bought a pack of 500 for 15RMB (but really, worth about 5RMB)
    • I need to learn how to solder… without blowing fuses…
    ]]>

    Xinshanzhai [1]: Seeed Studio and Facilitate Open Innovation

    December 26th, 2010 § 0 comments § permalink

    Xinchejian kicked off the first of the “Xinshanzhai” series of talks and discussion on how “Shanzhai” micro manufacture efficiency combined with open innovation process and open source hardware will change how China innovate. We had the honor to have Eric Pan, CEO and Founder of Seeed Studio to give the talk “Facilitate Open Innovation – The Seeed Studio Approach” [Speech Slides]. IMG_0138.JPG Seeed Studio was founded 3 years ago in Shenzhen to explore combining open source hardware and the electronics supply chain in Shenzhen. Today, Seeed Studio employes over 30 engineers and support staffs with over USD$1 million in annual revenue mainly from US, Europe and Japanese customers which are 98% of its business. Seeed does not yet focus on Chinese market as Eric points out that the tinkers/makers community in China has not yet matured enough for Seeed and there is not enough community. Seeed Studio has so far depends on words of mouth of open hardware community for its marketing and will launch its first marketing campaign in 2011. The following is one of the first ads to be run in Make Magazine. untitled.jpg Seeed’s current focus is to grow its WISH platform described by Eric as a ecosystem to support open source hardware designers to better manage the product life cycle. WISH platform let designers and users propose requests and new design and through the community voting and pre-ordering process to help to bring products to the market. The process is best illustrated by this slide from the speech. Seeed also works with partners sites such as Dangerous Prototypes to promote the platform. untitled.jpg Eric’s 30 minutes talk was followed by over 2 hours of heated discussion on the topics of open source hardware, innovation and manufacture. The talk and discussions were livecast on Sina Weibo by Steven Cheng under #新山寨#. ]]>

    RC Transmitter reverse-engineering attempt

    December 26th, 2010 § 1 comment § permalink

    TX2C ATS302T which is available on Taobao) , so I thought I would try to figure out the circuit by looking at it.  Kind of inconvenient because the components are on one side while the circuit trace is in the other. Flipping over the board constantly is annoying and it’s rather hard to follow.  Best would be to see both sides at the same time, no? So this is what I did:

    1. took a picture of both sides in macro mode
    2. cropped both pictures
    3. created layers using GIMP (a cross-platform OpenSource software similar to Photoshop)
    4. Put each image on their layers
    5. Change opacity of top layer
    6. “Image > Transform > Flip Horizontally” one of the image
    7. Move one of the image until screw holes on both align
    [gallery link="file"] Much easier then to figure out what is connected to what, but still difficult… Anyway, I decided to try instead to buy a TX2C and follow its datasheet to re-create the circuit.  In the meantime, I’ve removed the board entirely from the remote control body and I’ll connect to that directly with the Arduino.]]>

    Sketchup 8 is fun, useful to design stuff

    December 26th, 2010 § 0 comments § permalink

    Google Sketchup (now at version 8 ) is free and, as far as 3D software go, very easy-to-use with many features permitting coming up with useful plans for your next robot.  Most useful for the 3D-challenged however is the 3D Warehouse with user-contributed models. You can, for example, find a model of the Arduino Dueminalove and a range of sensors (such as the Parallax Ping or the Sharp IR sensor) in addition to parts such as servomotor and RC chassis.  These can be directly inserted into your design by simply going to File > 3D Warehouse > Get Models. The downside is that you’ll need to buy the pricey pro version (500$USD) to get the export features – which will be handy when you when to get your mechanical parts produced. But if you’re a Xinchejian member and working on a fun project, feel free to ask me to export your model to one of the many formats available. (Disclosure: I work for the company that makes Sketchup, however I don’t currently have any relationship with the team.)]]>

    Xinchejian on Hackerspaces.org

    December 23rd, 2010 § 0 comments § permalink

    http://hackerspaces.org/wiki/Xinchejian]]>

    Xinshanzhai edition 1: Facilitate Open Innovation, the Seeed Studio Approach 新山寨第一期: 开源硬件与开放式创新

    December 20th, 2010 § 2 comments § permalink

    Time: 3pm Dec 26, 2010 Location: Xin Che Jian, 2nd floor, Yongjia Rd 50 (close to Shaanxi Road South) Cost: 30RMB for non-Xinchejian members, free of charge for Xinchejian members. Seeed Studio is an open hardware facilitation company based in Shenzhen, China. Benefiting from local manufacture power and convenient global logistic system, we integrate resources to serve new era of innovation. Seeed also works with global distributors and partners to push open hardware movement. We design modular electronics for quick prototyping and small scale projects, which could be found at Bazaar. It also carries inventories from community innovators, we help people make, distribute their designs and collect the revenue. It’s a win-win situation and taking a shape towards an ecosystem. By working with us, innovators could focus on the designs, provide better support to the user and promote the product. Seeed Studio or similar service provider could get more traffic and bring up other product sales. The manufacture part of hardware involves a lot details. We provide Propagate service to facilitate the process. Innovator send finished prototype with manufacturing files including Gerber file, BOM, test plan and other requirements. Our engineering team will validate and integrate the design into small batch production line. All products will be tested and packed under instruction. Innovators could also view current manufacture and distribution status from propagate. After deducting the manufacture costs, profit will be returned to innovators when inventory sold out. To estimate the popularity before investing manufacture, innovators could post the idea or prototype to Wish. The community would vote, comment and collaborate on projects. You could also join interested groups to see what’s hot being worked on. By participating Wish, ideas with many votes could convert the popularity into coupons to purchase product or service. The idea poster could also share some coupon to the valuable commenter as appreciation. Products and service info are hosted at a wiki called Garden. Feel free to add your guide, project or yourself as a freelancer. About the speaker Eric Pan, founder and director of Seeed Studio, grew up with DIY culture in China. He graduated as an EE bachelor from Chongqing University, with experiences and prizes from national wide contests of MCU, Embe dded Design, Robotics, and English skills. He first joined Intel in Chengdu as a FCBGA product Engineer whose main job includes quality control and new product integration. Then he worked at Beamstream LLC as international sourcing manager on system solutions. He established Seeed Studio since 2008 from bare ground and now turning it into an open source hardware facilitator with 30+ employee. 新山寨第一期: 开源硬件与开放式创新 时间:2010年12月26日下午3点 地点:徐汇区永嘉路50号2楼新车间 (靠近陕西南路) 费用:新车间会员免费, 非新车间会员每人30元 Seeed Studio 是一个位于深圳的开源硬件生产公司. 得益于本土制造业的巨大力量以及便利的全球物流系统. 我们整合不同资源从而服务于新纪元创新时代. Seeed也与全球分销商和合作伙伴合作共同推动开源硬件的前进. Eric Pan 是Seeed studio 的创始人, 他从小受DIY文化影响. 他毕业于重庆大学,获得了电子工程学士学位. 他在微型计算机, 嵌入式设计, 机器人, 英文技能领域都有丰富经验集获奖. 他的第一份工作是在成都intel 担当FCBGA 产品工程师. 其主要工作是腹侧质量控制和新产品整合开发. 随后他在Beamstream LLC 工作担任国际采购经理. 在2008年他创立了Seeed studio —从零起点开始到现在拥有30名员工的开源硬件生产中心. 更多信息可以参考 http://seeedstudio.com/]]>

    A.R.T., PWM and RF

    December 20th, 2010 § 0 comments § permalink

    A.R.T.: Autonomous Robot Toy ^_^

    Some theory gleaned related to PWM and RF
    Disclaimer: this is my first contact with PWM and RF… Feel free to correct me.
    General PWM introduction
    Using the Arduino to do drive the transmitter circuit would be a temporary hack.  Best would be to be a simple circuit using a few dedicated IC to achieve the same (specifically the TX2C).
    Generating correct Pulse Modulation
    I’m trying to have Arduino output a PWM that will in turn drive the transmitter (using a crystal oscillator at a specific frequency) on/off to achieve the needed pulses.
    According to “How Stuff Works“,  RC control is four pulses that are 2.1 milliseconds long, with 700-microsecond intervals.
    The pulse segment, which tells the antenna what the new information is, uses 700-microsecond pulses with 700-microsecond intervals.  The number of pulses will tell what order to execute:
    • Forward: 16 pulses
    • Reverse: 40 pulses
    • Forward/Left: 28 pulses
    • Forward/Right: 34 pulses
    • Reverse/Left: 52 pulses
    • Reverse/Right: 46 pulses
    also:
    • RC control is 2.1 ms HIGH + 0.7ms LOW for a total of 2.8ms.
    • This represents a duty of 2.1/2.8 = 75% duty cycle and a frequency of 1/0.00028 = ~3571 Hz.
    • Pulse segment duty cycle is 50% (since pulse = interval) with a frequency of 1s/1.4ms (0.7ms+0.7ms) 714Hz.
    With the Arduino, we can specify duty cycle and track a certain total duration, but we still need a way to specify frequency.
    According to the Secrets of Arduino PWM and the Servo PWM FAQ the Arduino (or rather, the ATMega168 that it uses) has a 16Mhz clock with prescalers (1, 8, 64, 256, or 1024) that can divide this to a “timer”. Final precise control is done by using an integer in the ICR.  The microcontroller will count up to ICR and then count down back to 0, turning to HIGH everytime it gets to zero.
    Can probably dig this out of the ATMega168 doc:  http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf
    The equation is: desired_frequency = system_clock / (2*prescaler_value*ICR)
    (1/0.00028) = 16e6/ (2*prescaler*x) or x = (16e6*2.8e-4)/(2*prescaler)
    where prescaler…
    • 1: 2240
    • 8: 280
    • 64: 35
    • 256: 8.75
    • 1024: 2.1875
    …we can thus use prescaler value 1,8,64 + corresponding ICR value.  We cannot use 256 and 1024 because their results are fractional.
    Same exercise with the pulse segment:
    (1/0.0014) = 16e6 / (2*prescaler*x) or x = (16e6*1.4e-3)/(2*prescaler)
    where prescaler…
    • 1: 11200
    • 8: 1400
    • 64: 175
    • 256: 43.75
    • 1024: 10.9375
    …we can use either 1, 8 or 64 prescaler (the other two are fractional values).
    Higher prescale is better generally as lower timer also reduces power consumption.
    The ATmega timers script should be useful at some point, but I don’t understand the output right now…
    How do I turn this knowledge into an Arduino embedded program?
    I have no idea yet! I did try to manually create a PWM here by using sleeps:
    https://github.com/rngadam/ART/blob/master/rf_control/rf_control.pde
    …and feed that into an hacked together RF circuit based on what I could figure out from the circuit but it… obviously doesn’t do much
    I’ve come to the conclusion that buying the IC chip that does the same work and use the provided schematics… would be a lot easier…
    ]]>

    Ricky’s Autonomous Robot Toy Car Project

    December 20th, 2010 § 0 comments § permalink

    Saw Ricky came in with a RC car today and kicked his Robot RC car project. Very cool! Read more… Also, spoke NPI today about hosting robot RC car race in their place in the future. A robot F-1! That would be fun.]]>

    Google releases Android robot libraries – DIY Drones

    December 20th, 2010 § 0 comments § permalink

    Wow, this is pretty big news for us at Xinchejian. Google releases Android robot libraries. In China, we have access to the biggest variety of Android devices, all thanks to the Shanzhai industry.

    (Via DIYDrone.)

    ]]>